Dave wrote:
> Hi again Miguel,
>
> Here's some screen shots of the ribbons constructed with filled
> triangles. The only thing left to fix up is the light shading.
The screen shots look excellent!
> Looks like each segment is being done rather than each strand... hmmm,
I'll check this out over the
> next few days, better do some lab work ! :)
OK
> Looks really nice though !! could use more points per segment
> to get a finer surface, but until I fix up the shading, won't
> worry bout it !
Actually, I think you should hold off on the shading until we get
your code checked in to CVS. I think that the shading is going to
be difficult, and I will be in a better position to assist you if
I can take a look at your code.
But I think you *should* keep working on the granularity/points
per segment. I think that problem is a little easier to solve and
we need to solve it.
Here are my thoughts ...
You are currently dividing each segment into 10 subsegments. We
need to dynamically decide whether or not a segment needs to be
cut into smaller pieces. Something like this.
pixelThreshold = 4;
function renderSubsegment(topLeft, topRight, botLeft, botRight) {
if (topLeft.distance(topRight) < pixelThreshold &&
botLeft.distance(botRight) < pixelThreshold)
plot the triangles
else
calc topMiddle and botMiddle
renderSubsegment(topLeft, topMiddle, botLeft, botMiddle)
renderSubsegment(topMiddle, topRight, botMiddle, botRight)
}
I think we always want to cut a segment at least once:
calc segmentTopMiddle & segmentBotMiddle;
renderSubsegment(segmentTopLeft, segmentTopMiddle,
segmentBotLeft, segmentBotMiddle);
renderSubsegment(segmentTopMiddle, segmentTopRight,
segmentBotMiddle, segmentBotRight);
> You can also use the
>
> Ribbons 200 command to increase the width of the ribbons (like for the
strands)... still need to implement the color ribbons structure
> commands...
Shouldn't be difficult for you at this point.
> Where abouts should I start looking for the shading ?
> (haven't looked at all yet..)
org.jmol.g3d.Shade3D
for an example of the usage look at the CartoonRenderer where it is
rendering the beta sheet boxes.
But again, I suggest that you postpone the shading work until after you
have checked it.
The problem is this ... the shading is calculated based upon the normal
vector to the flat surface. In the case of a triangle one can easily
calculate the surface normal vector from the vertices of the triangle.
However, the code you are working with is using integer/screen
coordinates. And we are trying to make small triangles. Therefore,
'quantization errors' are going to cause problems with shading that will
be very evident.
We need to do these calculations in floating point (or fixed point) so
that we can use the fractional pixel values in order to properly calculate
the surface normal for each triangle.
I will be better able to assist if I can see the code as you are working
on it.
Do you have an account on sourceforge? If not, please go to www.sf.net and
register.
I can then add you to the jmol-developers group. That will allow you to
check in your code to the developer repository. Don't worry, I will help
make sure that we don't breaking anything as you check it.
Keep up the *great* work!
Miguel
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Jmol-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-developers