Newbie Question: How do I get a surface to look different on itssides?
4 Message(s) by 2 Author(s) originally posted in 3d java
| From: Bruce Feist |
Date: Tuesday, November 07, 2006
|
I have 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 have not been able to
solve using the
Sun tutorial or the
API (application
programming interface)documentation.
I'm
display ing 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
do not 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'd be to display a series of parallel arrows
point ing
across the strip, something like this:
----------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------
The arrows'd point up on one side, and
down on the other. Another
possibility'd be to use two colors to draw it, one for the top and
the other for the bottom. I do not much care which; they all boil down
to the same problem, which I can not figure out how to solve: how do I get
the two sides to look different? Can I've two
texture s, 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'd actually be pretty hard to get working for a Mobius
strip, I think -- I have not thought it through completely.)
Any suggestions'd be welcome. Please be gentle; I'm new to this!
Thanks,
Bruce Feist
| From: sanbikinoraion |
Date: Wednesday, November 08, 2006
|
A mobius strip'd, ofc, be represented as a triangle strip in
JAVA3d. A single triangle strip'd of course only fill on one side
(and JAVA3d will handily let you pick which side!) so my advice'd
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,'d 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!
wrote in message:
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 have not been able to
solve using the Sun tutorial or the API (application programming interface)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
do not 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'd be to display a series of parallel arrows pointing
across the strip, something like this:
----------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------------------------
The arrows'd point up on one side, and down on the other. Another
possibility'd be to use two colors to draw it, one for the top and
the other for the bottom. I do not much care which; they all boil down
to the same problem, which I can not figure out how to solve: how do I get
the two sides to look different? Can I've 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'd actually be pretty hard to get working for a Mobius
strip, I think -- I have not thought it through completely.)
Any suggestions'd be welcome. Please be gentle; I'm new to this!
Thanks,
Bruce Feist
| From: Bruce Feist |
Date: Wednesday, November 08, 2006
|
wrote in message:
A mobius strip'd, ofc, be represented as a triangle strip in
JAVA3d.
ofc = of course?
A single triangle strip'd of course only fill on one side
(and JAVA3d will handily let you pick which side!) so my advice'd
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 will give it a try! Thanks.
Bruce Feist
wrote in message:
I'm displaying a shape called a Mobius strip
how do I get the two sides to look different?
| From: sanbikinoraion |
Date: Thursday, November 09, 2006
|
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 would not have thought so. You'd need a very clever (and
simultaneously very stupid) renderer that'd 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.
Next Message: Using RotationInterpolator to rotate about multiple axis?