VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Apr 13 2011 - 09:49:34 CDT
- Next message: John Stone: "Re: X3DOM sphere resolution"
- Previous message: Joshua A. Anderson: "X3DOM sphere resolution"
- In reply to: Joshua A. Anderson: "X3DOM sphere resolution"
- Next in thread: John Stone: "Re: X3DOM sphere resolution"
- Reply: John Stone: "Re: X3DOM sphere resolution"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi Joshua,
I think that the sphere resolution is something that X3D leaves
as a decision that is entirely up to the viewer program and is not
specified by the X3D scene itself.
I suppose the idea behind the approach taken by X3D is that the
viewer could implement the sphere primitive with GLSL shaders
like I do in VMD and not draw a triangulated sphere at all.
Here's the X3D spec for the sphere geometry node:
http://www.web3d.org/x3d/specifications/OLD/ISO-IEC-19775-X3DAbstractSpecification/Part01/components/geometry3D.html#Sphere
In this case the X3DOM viewer itself is picking the sphere resolution.
I just spent a couple of minutes digging into the x3dom.js source code
and on or about line 721 of the code (search for the string
"latitudeBands"), you can see this:
var latNumber,longNumber;var latitudeBands=24;var longitudeBands=24;var theta,sinTheta,cosTheta;var phi,sinPhi,cosPhi;var x,y,z,u,v;for(latNumbe r=0;latNumber<=latitudeBands;latNumber++)
[...]
Human-readable version (line 721 of my 3 month old copy of x3dom.js):
var latNumber,longNumber;
var latitudeBands=24;
var longitudeBands=24;
var theta,sinTheta,cosTheta;
var phi,sinPhi,cosPhi;
var x,y,z,u,v;
for(latNumber=0; latNumber<=latitudeBands; latNumber++)
[...]
I would suggest changing "latitudeBands" and "longitudeBands"
values to 6 (very coarse), 8, or maybe 12. Any of those
should give you a very big boost in sphere rendering speed in X3DOM
vs. what you see when the loops are set to 24.
Just use values that match the VdW sphere "resolution" parameter
you prefer in VMD, and that should give you the same general appearance.
You can see similar for loops for Cylinders, Torii, and other shapes, so
any geometry you want to fiddle with you can just edit the x3dom.js
source code to get what you want in the short-term.
I'll contact the authors of X3DOM and suggest that they add some
special tags to let the user override these default resolution
parameters without having to modify the code... :-)
Cheers,
John Stone
vmd_at_ks.uiuc.edu
On Wed, Apr 13, 2011 at 08:09:37AM -0400, Joshua A. Anderson wrote:
> Hi list,
>
> I'm trying out the new X3DOM export (its pretty cool). Has anyone else run into performance issues with exporting VDW representations? Have you found a solution?
>
> VMD sensibly emits a <Sphere> node for each sphere in the representation. But the rendering ( at least in Firefox 4 ) uses a ridiculous number of triangles for each sphere and display performance suffers. The little x3dom status display reports over 2 million triangles in a tiny 1800 particle test model I exported.
> --------
> Joshua A. Anderson, Ph.D.
> Chemical Engineering Department, University of Michigan
>
-- NIH Resource for Macromolecular Modeling and Bioinformatics Beckman Institute for Advanced Science and Technology University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 Email: johns_at_ks.uiuc.edu Phone: 217-244-3349 WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
- Next message: John Stone: "Re: X3DOM sphere resolution"
- Previous message: Joshua A. Anderson: "X3DOM sphere resolution"
- In reply to: Joshua A. Anderson: "X3DOM sphere resolution"
- Next in thread: John Stone: "Re: X3DOM sphere resolution"
- Reply: John Stone: "Re: X3DOM sphere resolution"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]