If you play with the BACK_FACE/FRONT_FACE flag you don't have to touch the
normals. And that's pretty cheap, just traverse the subbranch and toggle the
PolygonAttributes flag in the Attributes of the Shape3D. You don't have to
touch the geometries.

In my case it's different. I have a complex process of analyzing and
processing for parts of the scene that's done only once, and after that
reused (like a compilation) and in that case I prefer to have a homogeneous
geometry. The compiled parts are recompiled only if the source information
changes, and that seldom happens.

Cheers,

Florin

-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED] Behalf Of N. Vaidya
Sent: Freitag, 19. März 2004 13:35
To: [EMAIL PROTECTED]
Subject: Re: [JAVA3D] Reflection Transform & Lighting


Yes, I'm aware of the BACK_FACE/FRONT_FACE flag. But the idea here is not to
mess around with any flags or geometric details of the subgraph that one
already has.

Assuming that toggling CCW/CW flag will produce the desired reflection
effect, then the cost of toggling the flag will be far cheaper than negating
the normals, especially for very large geometries, I'd think. Is there a way
to negate the normals without having to traverse every element of the normal
array ? If toggling the CCW flag will work, then the VertexArrays can be
left intact once set.

So, what I'm after is something like this:
Render the subgraph with CCW flag. Change CCW to CW. Render the subgraph
again to get the reflected geometry.

Anyways, thanks for the brainstorming, and it's possible that I may have
missed something in your argument.

Vaidya


>On Fri, 19 Mar 2004 10:08:01 +0100, Florin Herinean <[EMAIL PROTECTED]>
>wrote:

>Actually you can change the winding in the PolygonAttributes. The
>BACK_FACE/FRONT_FACE pair just specifies the winding. The AlternateWinding
>flag I'll change to be something more like a negation, allowing you to use
>an arbitrary combination of normal and reflected transforms in your
>scenegraph.
>
>Cheers,
>
>Florin
>
>-----Original Message-----
>From: Discussion list for Java 3D API
>[mailto:[EMAIL PROTECTED] Behalf Of N. Vaidya
>Sent: Mittwoch, 17. März 2004 19:53
>To: [EMAIL PROTECTED]
>Subject: Re: [JAVA3D] Reflection Transform & Lighting
>
>
>OK ! first fixed that stupid typo !
>
>Still looking into how elegantly could reflection be handled without having
>to walk the scenegraph to flip normals.
>
>Any ideas anybody if it could be done within the current framework of
>Java3D ?
>
>Wondering if an elegant solution would be to enhance the API to expose
>something akin to GL_CW and GL_CCW flags. For example, we could have a flag
>"AlternateWinding" taking on the values Winding_CW or Winding_CCW that
>which, when specified at a particular level in the scenegraph, will
override
>the winding of the subgraph below it. This flag could be encapsulated in a
>TransformGroup (for general applicability) or in a Link (if necessary to
>restrain its use to SharedGroup only). I think just flipping the winding
>will fix the reflection/lighting problem. Haven't given really much thought
>to this, and may not have considered all socio-political-technical
>ramifications of it :).
>
>any thoughts ?
>
>Vaidya
>
>
>
>
>
>
>>On Tue, 16 Mar 2004 02:46:31 -0700, N. Vaidya <[EMAIL PROTECTED]>
wrote:
>
>>The problem with reflection appears to be that the CCW winding and the
>>*transformed* normal direction are inconsistent, unlike the case of
>rotation.
>>Consider, for example, a quad that is on the -ve xy plane and rotated 180
>>deg. about the y-axis. The result, coordinate wise, should be identical to
>>reflection about the xz-plane, but the normals will be flipped.
>>
>>There probably is an OGL way to specify the winding explicitly, but if the
>>objective is to re-use large scenegraphs using a SharedGroup, then it
>>becomes a wee bit difficult to treat reflection generally. Wonder, if ther
e
>>are any tricks to achieve this easily.
>>
>>
>>
>>>On Tue, 16 Mar 2004 01:49:14 -0700, N. Vaidya <[EMAIL PROTECTED]>
>wrote:
>>
>>>Well, I have both CULL_NONE and normalflip always set to true since I
need
>>>to see 2 lit sides always. And the problem is that setting
>>>backFaceNormalFlip to true kills both front and back lighting on the
>>>reflected geometry. Setting the flip flag to false, produces correct
front
>>>side lighting, but then expectedly a black back face.
>>>
>>>Actually, the interesting thing is that if rotation can correctly handle
>the
>>>appropriate CCW winding and normal flips, what is it about reflected
>>>geometry that causes the issue ?
>>>
>>>Vaidya
>>>
>>>
>>>
>>>>On Tue, 16 Mar 2004 09:41:07 +0100, Florin Herinean
<[EMAIL PROTECTED]>
>>>wrote:
>>>
>>>>There is a flag in the PolygonAttributes to flip the normals if the
>>>>transform contains a reflection. However, that one works only with the
>>>>opengl version, and not with the directx version of j3d.
>>>>
>>>>Cheers,
>>>>
>>>>Florin
>>>>
>>>>-----Original Message-----
>>>>From: Discussion list for Java 3D API
>>>>[mailto:[EMAIL PROTECTED] Behalf Of N. Vaidya
>>>>Sent: Montag, 15. März 2004 20:55
>>>>To: [EMAIL PROTECTED]
>>>>Subject: [JAVA3D] Refelction Transform & Lighting
>>>>
>>>>
>>>>I'm using the following Transform3D
>>>>
>>>>m_00 = -1, m_11 = m_22 = m_33 = 1, and zero for all other elements,
>>>>
>>>>on a TransformGroup to effect a reflection of the scenegraph about
>>>>the yz-plane. And when I do that, the geometry gets transformed
correctly
>>>>but the diffuse and specular lightings get clobbered !
>>>>
>>>>Is there any issue with transforming normals with the above
>>>>matrix structure, or am I missing something trivial !
>>>>
>>>>
> =========================================================================
>>>>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>>>>of the message "signoff JAVA3D-INTEREST".  For general help, send email
>to
>>>>[EMAIL PROTECTED] and include in the body of the message "help".
>>>>
>>>>
> =========================================================================
>>>>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>>>>of the message "signoff JAVA3D-INTEREST".  For general help, send email
>to
>>>>[EMAIL PROTECTED] and include in the body of the message "help".
>>>
>>>=========================================================================
=
>=
>>>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
>>>of the message "signoff JAVA3D-INTEREST".  For general help, send email
to
>>>[EMAIL PROTECTED] and include in the body of the message "help".
>>
>>==========================================================================
=
>>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
>>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>>[EMAIL PROTECTED] and include in the body of the message "help".
>
> ==========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
> ==========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to