Changes between Initial Version and Version 1 of Ticket #15899, comment 12


Ignore:
Timestamp:
Sep 10, 2024, 12:29:23 PM (14 months ago)
Author:
Tom Goddard

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15899, comment 12

    initial v1  
    1 {{{
     1
    22The target of the camera in Babylon in the Sandbox calculates a bounding box around the object (you can see it with the square icon that is in the same line as "scene" in the debugger), then the camera locks to the center of that.  I can see the transforms are applied in Blender and in Babylon on the centering object.  Babylon expects users to not necessarily anchor their models correctly, so they calculate a bounding box using the mesh object and use that to target the camera.  I've done this myself in NIH 3D because without it, Babylon has the same issues as Blender does with these files.
    33
     
    77
    88K
    9 
    10 
    11 
    12 -----Original Message-----
    13 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
    14 Sent: Tuesday, September 10, 2024 1:49 PM
    15 To: goddard@cgl.ucsf.edu; Browne, Kristen (NIH/NIAID) [C] <kristen.browne@nih.gov>
    16 Cc: gregc@cgl.ucsf.edu
    17 Subject: [EXTERNAL] Re: [ChimeraX] #15899: WRL vs. GLB output
    18 
    19 #15899: WRL vs. GLB output
    20 ---------------------------------------+-------------------------
    21           Reporter:  kristen.browne@...  |      Owner:  Tom Goddard
    22               Type:  defect            |     Status:  assigned
    23           Priority:  normal            |  Milestone:
    24          Component:  Input/Output      |    Version:
    25         Resolution:                    |   Keywords:
    26         Blocked By:                    |   Blocking:
    27 Notify when closed:                    |   Platform:  all
    28            Project:  ChimeraX          |
    29 ---------------------------------------+-------------------------
    30 Comment (by Tom Goddard):
    31 
    32  Hi Kristen,
    33 
    34    I don't understand the centering problem with .glb.  The first part of  the .glb file is text and here it is for your example
    35 
    36  {{{
    37  JSON{"asset": {"version": "2.0", "generator": "UCSF ChimeraX  1.9.dev202407250342"}, "scenes": [{"nodes": [2]}], "nodes": [{"name":
    38  "emdb 36702", "children": [1]}, {"name": "surface", "mesh": 0}, {"name":
    39  "centering", "children": [0], "matrix": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,  0, -160.12539672851562, -104.11528015136719, -165.6245880126953, 1]}],
    40  "meshes": [{"primitives": [{"attributes": {"POSITION": 0, "NORMAL": 1,
    41  "COLOR_0": 2}, "indices": 3, "mode": 4, "material": 0}]}], "accessors":
    42  [{"count": 82762, "type": "VEC3", "componentType": 5126, "min":
    43  [99.15726470947266, 45.51429748535156, 102.22604370117188], "max":
    44  [239.1072998046875, 161.9818878173828, 229.0090789794922], "bufferView":
    45  0}, {"count": 82762, "type": "VEC3", "componentType": 5126, "bufferView":
    46  1}, {"count": 82762, "type": "VEC4", "componentType": 5123, "normalized":
    47  true, "bufferView": 2}, {"count": 333852, "type": "SCALAR",
    48  "componentType": 5125, "bufferView": 3}], "bufferViews": [{"byteLength":
    49  993144, "byteOffset": 0, "buffer": 0, "target": 34962}, {"byteLength":
    50  993144, "byteOffset": 993144, "buffer": 0, "target": 34962},
    51  {"byteLength": 662096, "byteOffset": 1986288, "buffer": 0, "target":
    52  34962}, {"byteLength": 1335408, "byteOffset": 2648384, "buffer": 0,
    53  "target": 34963}], "buffers": [{"byteLength": 3983792}], "materials":
    54  [{"pbrMetallicRoughness": {"baseColorFactor": [1.0, 1.0, 1.0, 1.0],
    55  "metallicFactor": 0, "roughnessFactor": 1}}]}  }}}
    56 
    57  There is the part that defines the "centering" node and gives a "matrix"
    58  which does the centering.  From what you say that is not working  correctly, although it appears to me to be working correctly in BabylonJS.
    59  I think a worthwhile test would be to make the output the .glb from  ChimeraX without the centering (command "save test.glb center false") and  compare the centering in Blender or C4D or any of the software where you  think the centering is not working.  See if the files with centering and  without centering give the same center as if the software is ignoring the  centering matrix, or if they give different results.  If the results are  different is the one without centering correct?  Maybe the sign of the  translation in the matrix is opposite what it should be.
    60 
    61  The reason I say BabylonJS appears to show the centering working is that  the "default camera" node "target" shows as -9,-.037,-.01 which is  approximately 0,0,0 (the size of the surface is about 300).  The reason it  is not exactly 0,0,0 is I believe because ChimeraX is including the hidden  vertices when computing the center of bounding box while BabylonJS is  probably computing it correctly to center its camera and so they are  slightly different.
    62 
    63  I will compare centered versus not centered in BabylonJS and if you could  do it in the other software we might figure out if some of the software is  just ignoring the matrix that is supposed to do the centering.  If it is  ignoring the matrix then we may need to use some other technique.
    64 
    65  I will also try to remove the unused vertices, although that is not  related to the far off centering issue.
    66 
    67     Tom
    68 --
    69 Ticket URL: <https://www.rbvi.ucsf.edu/trac/ChimeraX/ticket/15899#comment:8>
    70 ChimeraX <https://www.rbvi.ucsf.edu/chimerax/>
    71 ChimeraX Issue Tracker
    72 CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and are confident the content is safe.
    73 }}}