Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / November 2006

Tip: Looking for answers? Try searching our database.

Newbie Question: How do I get a surface to look different on its sides?

Thread view: 
Bruce Feist - 08 Nov 2006 04:06 GMT
I've recently started playing with Java3d; I teach Java in HS and am
eventually hoping to incorporate some game design into my course.
Anyway, I'm running into a bit of a problem which I haven't been able to
solve using the Sun tutorial or the API documentation.

I'm displaying a shape called a Mobius strip, and I want to display it
in such a way that you can tell which side you're looking at
(technically it has just one side,  but the concept remains).  If you
don't know what a Mobius strip is, that probably won't matter for your
answer to the problem -- if you're curious, think of it as a long strip
of paper in a loop, with a twist in it so that what was the 'front'
turns into the 'back'.

One possibility would be to display a series of parallel arrows pointing
across the strip, something like this:

----------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------

The arrows would point up on one side, and down on the other.  Another
possibility would be to use two colors to draw it, one for the top and
the other for the bottom.  I don't much care which; they all boil down
to the same problem, which I can't figure out how to solve: how do I get
the two sides to look different?  Can I have two textures, one which is
visible from the front and the other from the back?  Must I resort to
havng two actual surfaces at a small displacement from each other?
(This one would actually be pretty hard to get working for a Mobius
strip, I think -- I haven't thought it through completely.)

Any suggestions would be welcome.  Please be gentle; I'm new to this!

Thanks,
Bruce Feist
sanbikinoraion - 08 Nov 2006 12:44 GMT
A mobius strip would, ofc, be represented as a triangle strip in
java3d. A single triangle strip would of course only fill on one side
(and java3d will handily let you pick which side!) so my advice would
be to make a triangle strip, clone it, and texture it appropriately,
then take the cloned triangle strip, flip the visible surface, and
texture it in the other manner. Of course, because of the half twist,
the textures will appear to suddenly flip over where the triangle strip
starts and ends.

My suggestion, therefore, would be to colour shade the individual
vertices of the triangle strip starting from red and running halfway
through the spectrum. The backface triangle strip should do the same,
running from halfway through the spectrum to the end of the spectrum (a
very reddish magenta).

Hope that helps!

sanbikinoraion

> I've recently started playing with Java3d; I teach Java in HS and am
> eventually hoping to incorporate some game design into my course.
[quoted text clipped - 30 lines]
> Thanks,
> Bruce Feist
Bruce Feist - 09 Nov 2006 01:50 GMT
> A mobius strip would, ofc, be represented as a triangle strip in
> java3d.

ofc = of course?

> A single triangle strip would of course only fill on one side
> (and java3d will handily let you pick which side!) so my advice would
> be to make a triangle strip, clone it, and texture it appropriately,
> then take the cloned triangle strip, flip the visible surface, and
> texture it in the other manner.

Hmm... I won't have trouble with one of the strips blocking the other
from view if they're in the same locations?  If that's the case, this
should work out pretty straightforwardly... I just need *one* triangle
strip, corresponding to the single surface of the mobius strip, which
would go around twice, once for the "front side" and once for the "back
side".  And then the texture mismatch should go away.

I'll give it a try!  Thanks.

Bruce Feist

>> I'm displaying a shape called a Mobius strip
>>
>> how do I get the two sides to look different?
sanbikinoraion - 09 Nov 2006 10:04 GMT
ofc = of course, ofc :P

> Hmm... I won't have trouble with one of the strips blocking the other
> from view if they're in the same locations?

I wouldn't have thought so. You would need a very clever (and
simultaneously very stupid) renderer that would simultaneously be able
to clip polygons in the view plane according to occlusion (which iirc
is quite difficult to do correctly in realtime) but simultaneously be
clipping against other polygons that have already been backface-culled.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.