We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

thomasup

Forum Replies Created

Viewing 15 posts - 31 through 45 (of 55 total)
  • Author
    Posts
  • in reply to: Oppo Find X2 Pro #36316
    thomasup
    Customer

    very interesting part with the benchmarking and quality adjustment! seems like a solid solution.
    we will need similar adjustment to device performance in the future, maybe we can learn from this implementation.

    overall, it would be interesting to see dynamic resolutions scaling as a base feature on v3d.

    in reply to: orbit camera collision / limits (feature request?) #36311
    thomasup
    Customer

    we made an extension script, which draws the limits as a mesh.
    it is very hacky as of now, but helps iterate faster on the limits.

    a nicer implementation as overlay / tool / handle would be nice, but not sure how this is possible in blender 2.8+.

    import bpy, bmesh, mathutils, math
    
    def draw():
        camera = bpy.context.active_object
    
        obj = bpy.context.scene.objects.get("debugCube")
        if not obj:
            mesh = bpy.data.meshes.new("debugCube")
            obj = bpy.data.objects.new(mesh.name, mesh)
            scene = bpy.context.scene
            scene.collection.objects.link(obj)
        else:
            mesh = obj.data
    
        verts = []
        edges = []
        faces = []
    
        # get camera limits
        tgt = camera.data.v3d.orbit_target
        pos = camera.location
        camDirection = pos-tgt
        near = camDirection.normalized()*camera.data.v3d.orbit_min_distance+tgt
        far  = camDirection.normalized()*camera.data.v3d.orbit_max_distance+tgt
    
        # add cross at target position
        def drawCross (position):
            verts.append(position-mathutils.Vector((0,1,0)))
            verts.append(position+mathutils.Vector((0,1,0)))
            verts.append(position-mathutils.Vector((1,0,0)))
            verts.append(position+mathutils.Vector((1,0,0)))
            verts.append(position-mathutils.Vector((0,0,0)))
            verts.append(position+mathutils.Vector((0,0,1)))
        drawCross(tgt)
    
        #add line from near to far, in camera direction
        verts.append(near)
        verts.append(far)
    
        #add circles
        count = 32
    
        #add circle for horizontal limits at near limit distance
        angle = camera.data.v3d.orbit_min_azimuth_angle
        endAngle = camera.data.v3d.orbit_max_azimuth_angle
        sweepAngle = endAngle-angle
    
        for i in range(count):
            angle += sweepAngle/count
            verts.append(mathutils.Vector((math.sin(angle),-math.cos(angle),0)) *camera.data.v3d.orbit_min_distance + tgt)
    
        #add circle for vertical limits at far limit distance    
        angle = camera.data.v3d.orbit_min_polar_angle
        endAngle = camera.data.v3d.orbit_max_polar_angle
        sweepAngle = endAngle-angle
    
        for i in range(count):
            angle += sweepAngle/count
            verts.append(mathutils.Vector((0,-math.sin(angle),math.cos(angle))) *camera.data.v3d.orbit_max_distance + tgt)
    
        for i in range(int(len(verts)/2)):
            edges.append([i*2,i*2+1])
    
        mesh.from_pydata(verts, edges, faces)
    
        #def emptyAtPosition (name, position, direction):
        #    obj = bpy.context.scene.objects.get(name)
        #    o = bpy.data.objects.new( "empty", None )
    
    class DrawCameraLimits(bpy.types.Operator):
        """draw the camera limits as a 3d object"""
        bl_idname = "object.draw_limits"
        bl_label = "draw limits"
        bl_options = {'REGISTER', 'UNDO'}
          
        def execute(self, context):
            draw()
            return {'FINISHED'}
        
        
    
    def menu_func(self, context):
        layout = self.layout
        print("test")
        layout.separator()
        layout.operator(DrawCameraLimits.bl_idname)
    
    classes=[ DrawCameraLimits ]
    
    def register():
        for c in classes:
            bpy.utils.register_class(c)
            
        bpy.types.V3D_PT_CameraSettings.append(menu_func)
        
    
    def unregister():
        for c in classes:
            bpy.utils.unregister_class(c)
            
        bpy.types.V3D_PT_CameraSettings.remove(menu_func)
        
    
    if __name__ == "__main__":
        register()
    Attachments:
    You must be logged in to view attached files.
    in reply to: orbit camera collision / limits (feature request?) #35576
    thomasup
    Customer

    made a short script, that shows the limits:

    it adds a button to the UI: currently it is creating a mesh, with the near and far limits & angle limits.
    downside: you have to undo / delete it & click the button again, every time you change a limit value.
    upside: you dont have to export to find out

    maybe this can be fleshed out & integrated into v3d natively

    
    # Author: Thomas Pahler @ UP Designstudio
    
    import bpy, bmesh, mathutils, math
    
    def draw():
        camera = bpy.context.active_object
    
        obj = bpy.context.scene.objects.get("debugCube")
        if not obj:
            mesh = bpy.data.meshes.new("debugCube")
            obj = bpy.data.objects.new(mesh.name, mesh)
            scene = bpy.context.scene
            scene.collection.objects.link(obj)
        else:
            mesh = obj.data
    
        verts = []
        edges = []
        faces = []
    
        # get camera limits
        tgt = camera.data.v3d.orbit_target
        pos = camera.location
        camDirection = pos-tgt
        near = camDirection.normalized()*camera.data.v3d.orbit_min_distance+tgt
        far  = camDirection.normalized()*camera.data.v3d.orbit_max_distance+tgt
    
        # add cross at target position
        def drawCross (position):
            verts.append(position-mathutils.Vector((0,1,0)))
            verts.append(position+mathutils.Vector((0,1,0)))
            verts.append(position-mathutils.Vector((1,0,0)))
            verts.append(position+mathutils.Vector((1,0,0)))
            verts.append(position-mathutils.Vector((0,0,0)))
            verts.append(position+mathutils.Vector((0,0,1)))
        drawCross(tgt)
    
        #add line from near to far, in camera direction
        verts.append(near)
        verts.append(far)
    
        #add circles
        count = 32
    
        #add circle for horizontal limits at near limit distance
        angle = camera.data.v3d.orbit_min_azimuth_angle
        endAngle = camera.data.v3d.orbit_max_azimuth_angle
        sweepAngle = endAngle-angle
    
        for i in range(count):
            angle += sweepAngle/count
            verts.append(mathutils.Vector((math.sin(angle),-math.cos(angle),0)) *camera.data.v3d.orbit_min_distance + tgt)
    
        #add circle for vertical limits at far limit distance    
        angle = camera.data.v3d.orbit_min_polar_angle
        endAngle = camera.data.v3d.orbit_max_polar_angle
        sweepAngle = endAngle-angle
    
        for i in range(count):
            angle += sweepAngle/count
            verts.append(mathutils.Vector((0,-math.sin(angle),math.cos(angle))) *camera.data.v3d.orbit_max_distance + tgt)
        
        # make edges
        for i in range(int(len(verts)/2)):
            edges.append([i*2,i*2+1])
    
        mesh.from_pydata(verts, edges, faces)
    
        #def emptyAtPosition (name, position, direction):
        #    obj = bpy.context.scene.objects.get(name)
        #    o = bpy.data.objects.new( "empty", None )
        
    
    class DrawCameraLimits(bpy.types.Operator):
        bl_idname = "v3d.draw_camera_limits"
        bl_label = "Draw Limits"
        bl_options = {"REGISTER", "UNDO"}
    
        def execute(self, context):
            draw()
            return {'FINISHED'}
    
    def menu_func(self, context):
        self.layout.operator(DrawCameraLimits.bl_idname)
    
    bpy.utils.register_class(DrawCameraLimits)
    bpy.types.V3D_PT_CameraSettings.append(menu_func)
    
    #bpy.ops.v3d.draw_camera_limits()
    in reply to: [feature request] debug loading times #35288
    thomasup
    Customer

    thank you! that would be very helpful!

    in reply to: [feature request] debug loading times #35272
    thomasup
    Customer

    indeed, there are many factors to it. basically, the proposal was to add more metrics to the performance profile.

    currently, it only says:
    Scene Loading Time: 24111ms

    my proposal would be smth like:

    Total Scene Loading Time: 24.11s
    gltf Download: 2s
    decompressing: 1.2s
    Loading Geometry: 4.10s
    Texture Loading: 2.3s
    Compiling shaders: 8.20s
    Scene Setup: 0.5s

    this would give a quick and easy way to start optimizing the load times, without having to do performance tests on various devices, multiple times, comparing load times etc.

    i think this would be a valuable feature.

    in reply to: ambient occlusion maps on gltf materials #35040
    thomasup
    Customer

    as a fallback, we wanted to use the AO as base color on metallic surfaces, but it seems the multiply node does not work on our end. (v3d 3.4.0)

    the texture is not applied, when the node is attached in between.
    without the multiply node, the texture is loaded.

    Attachments:
    You must be logged in to view attached files.
    in reply to: ambient occlusion maps on gltf materials #35032
    thomasup
    Customer

    the gltf material seems to indroduce some differences in shading, though.
    maybe there it is mixed differently, or it uses a different gamma, but we are not able to reproduce the same strength of ao in the browser, as we have in eevee.

    Attachments:
    You must be logged in to view attached files.
    in reply to: ambient occlusion maps on gltf materials #35025
    thomasup
    Customer

    it seems to work!
    the map is visible, and the material is a MeshStandardMaterial in the browser.

    nice!

    in reply to: [feature request] debug loading times #35024
    thomasup
    Customer

    we made a short script, that list materials which could be converted to gltf2 materials:

    import bpy
    
    # count the materials using gltf2 compatible
    gltf2count = 0
    print("gltf2 compatible material enabled on:")
    
    for m in bpy.data.materials:
        if m.v3d.gltf_compat:
            gltf2count += 1
            print(m)
            
    print("gltf2 Materials: " + str(gltf2count))
    print("")
    
    # find simple materials, that could be converted to gltf2
    print("simple materials to consider making gltf2:")
    for m in bpy.data.materials:
        
        # get the material node tree
        nt = m.node_tree
        node_count = 0
        
        # loop all nodes
        for n in nt.nodes:
            # do not count output nodes, or principled BSDF nodes
            if n.type != "BSDF_PRINCIPLED" and n.type != "OUTPUT_MATERIAL":
                node_count += 1
                
        # if the material has less than 2 remaining node, list it in the console
        if node_count < 2 and not m.v3d.gltf_compat:
            print(m)

    it is very basic for now, but helped us quickly find the materials that can be converted without visual changes.

    in reply to: ambient occlusion maps on gltf materials #35021
    thomasup
    Customer

    thank you for the info!

    how would this look, if we only have an ao texture, and all other parameters are solid color?
    can we omit the separateRGB node, like in the screenshot?

    Attachments:
    You must be logged in to view attached files.
    in reply to: [feature request] debug loading times #35008
    thomasup
    Customer

    so it seems like the amount of materials / shaders accounts to ~1/3 of our loading time… that is heavy, but understandable, since we had 102 materials going.

    this will give us room for improvement now.

    still, a feature that simply prints out the contributing factors/times in the console could save loads of time in finding the shortcomings

    in reply to: Replace all textures on runtime #34972
    thomasup
    Customer

    also, mat.nodeTextures[i_index].image.src; can be undefined, make sure to check for that.

    in reply to: Replace all textures on runtime #34971
    thomasup
    Customer

    use v3d.ImageLoader(); instead of v3d.TextureLoader();

    that does the trick for me

    in reply to: pricipled bsdf clear coat missing in 3.4 #34727
    thomasup
    Customer

    reason seems to be the v3d.js package.
    when using the old 3.3.1 v3d.js with a file exported in 3.4, the clear coat still works

    in reply to: orbit controls properties / zoom #34125
    thomasup
    Customer

    ah, i see.

    we were trying to access it via
    app.camera.controls.enableZoom
    where it does not exist.

    but
    app.controls.enableZoom
    works just fine!

Viewing 15 posts - 31 through 45 (of 55 total)