AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> 3D Graphics API's for Java
View previous topic :: View next topic  
Author Message
Bruce Feist
Guest





PostPosted: Wed Nov 08, 2006 8:10 am    Post subject: Newbie Question: How do I get a surface to look different on Reply with quote



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
Back to top
sanbikinoraion
Guest





PostPosted: Wed Nov 08, 2006 6:44 pm    Post subject: Re: Newbie Question: How do I get a surface to look differen Reply with quote



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


Bruce Feist wrote:
Quote:
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
Back to top
Bruce Feist
Guest





PostPosted: Thu Nov 09, 2006 7:50 am    Post subject: Re: Newbie Question: How do I get a surface to look differen Reply with quote



sanbikinoraion wrote:
Quote:
A mobius strip would, ofc, be represented as a triangle strip in
java3d.

ofc = of course?

Quote:
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

Quote:
Bruce Feist wrote:

I'm displaying a shape called a Mobius strip

how do I get the two sides to look different?
Back to top
sanbikinoraion
Guest





PostPosted: Thu Nov 09, 2006 4:04 pm    Post subject: Re: Newbie Question: How do I get a surface to look differen Reply with quote

ofc = of course, ofc :P

Quote:
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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> 3D Graphics API's for Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.