two-pass-rendering of a model

two-pass-rendering of a model

Post by Jakob Bielin » Tue, 10 Oct 2000 04:00:00



Hi!
  i want to render a textured model.  but i also want to get the effect of a
shiny and reflective material by using environment mapping.  now, i am
rendering the onject with its regular texture, and then i render it again
with the environment mapping.  but this does not seem to work right, because
of the depth-testing.  some triangles of the env-map are drawn, some are
not.  how can i avoid this?  or is there another way to achieve this?  what
about multi-texturing?  is it supported by all cards (also by the older ones
like the RIVA128)???  how can i use it?

thanx for your help,
jb

 
 
 

two-pass-rendering of a model

Post by Paul Mart » Tue, 10 Oct 2000 04:00:00


Get twopass.cpp from here: http://www.frii.com/~martz/oglfaq/source.htm. It
should help you understand what you've done incorrectly.
--

    Hewlett Packard Technical Solutions Lab
    OpenGL FAQ: http://www.opengl.org/About/FAQ/Technical.html
                http://www.frii.com/~martz/oglfaq


Quote:> Hi!
>   i want to render a textured model.  but i also want to get the effect of
a
> shiny and reflective material by using environment mapping.  now, i am
> rendering the onject with its regular texture, and then i render it again
> with the environment mapping.  but this does not seem to work right,
because
> of the depth-testing.  some triangles of the env-map are drawn, some are
> not.  how can i avoid this?  or is there another way to achieve this?
what
> about multi-texturing?  is it supported by all cards (also by the older
ones
> like the RIVA128)???  how can i use it?

> thanx for your help,
> jb


 
 
 

two-pass-rendering of a model

Post by Jakob Bielin » Tue, 10 Oct 2000 04:00:00




Quote:> Get twopass.cpp from here: http://www.frii.com/~martz/oglfaq/source.htm.
It
> should help you understand what you've done incorrectly.

i looked at it, and didn't find any major differences.  the only thing i
noticed is that your sample does not use a environment map for the second
pass.  you just use it to show the specular highlight when textures are
enabled.

jb

 
 
 

two-pass-rendering of a model

Post by Paul Mart » Tue, 10 Oct 2000 04:00:00





> > Get twopass.cpp from here: http://www.frii.com/~martz/oglfaq/source.htm.
> It
> > should help you understand what you've done incorrectly.

> i looked at it, and didn't find any major differences.  the only thing i
> noticed is that your sample does not use a environment map for the second
> pass.  you just use it to show the specular highlight when textures are
> enabled.

Did you compile and run my example code? It works on all platforms I've
tried it on; if it doesn't work on yours, that would explain it.

Note it's not guaranteed to work. Z values from two rendering passes each
having different state are not guaranteed by OpenGL spec to be identical.
Your best bet is to try to minimize the state differences between the two
passes in the hopes that the Z values will be identical.
--

    Hewlett Packard Technical Solutions Lab
    OpenGL FAQ: http://www.opengl.org/About/FAQ/Technical.html
                http://www.frii.com/~martz/oglfaq

 
 
 

two-pass-rendering of a model

Post by Jakob Bielin » Tue, 10 Oct 2000 04:00:00


Quote:> Did you compile and run my example code? It works on all platforms I've
> tried it on; if it doesn't work on yours, that would explain it.

no, id does work indeed!  i select "Two Pass" from the menu and it works
fine.  but that is not exactly what i am looking for.  i have a textured
object and want to use environment mapping on that object.  but since the
object is already textured, i thought about rendering in two passes: one
pass with the "normal" texture and the second one with the environment map.
and thats where i get those problems.

Quote:

> Note it's not guaranteed to work. Z values from two rendering passes each
> having different state are not guaranteed by OpenGL spec to be identical.
> Your best bet is to try to minimize the state differences between the two
> passes in the hopes that the Z values will be identical.

that might be one reason for my problem...
 
 
 

two-pass-rendering of a model

Post by Han Sol » Tue, 10 Oct 2000 04:00:00


http://nehe.gamedev.net/
look under openGL tutorials... there is also a tutorial for multitexturing
(the bumpmap tutorial)

have fun

Christopher

--
--
Han Solo auf SoddeBecken


ICQ#   64040898
ftp      ftp://SoddeBecken

"Our brains are on fire with the feeling to kill and it wont go away untill
we drink all your beers"-James Hetfield
"At the end of the day you know what feels best. You play what you play,
man. And that's big, fat guitars."-James Hetfield
"Mache ich etwas richtig, merkt es keiner,
mache ich etwas falsch, vergisst es keiner."
"You laugh because I'm different--I laugh because you're all the same"
"I'm going to live for ever or die trying"

 
 
 

two-pass-rendering of a model

Post by Paul Mart » Tue, 10 Oct 2000 04:00:00



Quote:> > Did you compile and run my example code? It works on all platforms I've
> > tried it on; if it doesn't work on yours, that would explain it.
> no, id does work indeed!  i select "Two Pass" from the menu and it works
> fine.  but that is not exactly what i am looking for.  i have a textured
> object and want to use environment mapping on that object.  but since the
> object is already textured, i thought about rendering in two passes: one
> pass with the "normal" texture and the second one with the environment
map.
> and thats where i get those problems.

Note that my code example also uses texture mapping for the second pass,
except the second texture map is all white. The fact that your texture
coordinates are generated with environment mapping, I'd think would make
little difference. But apparently it does. :-(
--

    Hewlett Packard Technical Solutions Lab
    OpenGL FAQ: http://www.opengl.org/About/FAQ/Technical.html
                http://www.frii.com/~martz/oglfaq
 
 
 

two-pass-rendering of a model

Post by ZZ » Wed, 11 Oct 2000 06:52:47


if the specular two pass method works then your code should also work
just subsistite? an environment mapping pass for the specular pass.
maybve the precision of your depth buffer aint precide enuf

--
GET IT HERE http://members.xoom.com/myBollux  FREE BOLLUX


> no, id does work indeed!  i select "Two Pass" from the menu and it works
> fine.  but that is not exactly what i am looking for.  i have a textured
> object and want to use environment mapping on that object.  but since the
> object is already textured, i thought about rendering in two passes: one
> pass with the "normal" texture and the second one with the environment map.
> and thats where i get those problems.

 
 
 

two-pass-rendering of a model

Post by Jakob Bielin » Wed, 11 Oct 2000 04:00:00


i also read that you should not use display lists, because they store the
accuracy of a float differently.  could that be it?  i noticed, that even if
if glScale(1.1f, 1.1f, 1.1f); i still get a few (but less of course!)
triangles that are not correct.  but i think display lists are the fastest,
because i am dealing with up to 2500 vertices and about 2000 faces.  drawing
this with a loop will be very slow, i think.

jb

 
 
 

two-pass-rendering of a model

Post by Jakob Bielin » Wed, 11 Oct 2000 04:00:00




Quote:> if the specular two pass method works then your code should also work
> just subsistite? an environment mapping pass for the specular pass.
> maybve the precision of your depth buffer aint precide enuf

well, in the sample code, there are no display lists used.  i heard that
these don't save the real accuracy of floats...

jb

 
 
 

two-pass-rendering of a model

Post by Jakob Bielin » Wed, 11 Oct 2000 04:00:00




Quote:> http://nehe.gamedev.net/
> look under openGL tutorials... there is also a tutorial for multitexturing
> (the bumpmap tutorial)

> have fun

> Christopher

well, i already took a look at this.  since it is an extension, can i be
sure, that all cards support this?

jb

 
 
 

two-pass-rendering of a model

Post by Paul Mart » Wed, 11 Oct 2000 04:00:00



Quote:> i also read that you should not use display lists, because they store the
> accuracy of a float differently.

?? Where did you hear THAT?!

The OpenGL spec states that display lists must produce the same results as
if their contents had been submitted to OpenGL directly. An implementation
can not restrict the precision of values stored in display lists any more
than it would restrict the precision of the same values through the
immediate mode API.
--

    Hewlett Packard Technical Solutions Lab
    OpenGL FAQ: http://www.opengl.org/About/FAQ/Technical.html
                http://www.frii.com/~martz/oglfaq

 
 
 

two-pass-rendering of a model

Post by Paul Mart » Wed, 11 Oct 2000 04:00:00



Quote:> well, i already took a look at this.  since it is an extension, can i be
> sure, that all cards support this?

No, all cards may not support it. When using an extension, be sure to check
for its presence using standard methods (see the FAQ). That said, A lot of
vendors do support the multitexturing extension, it is more globally
supported than any extension I've seen.
--

    Hewlett Packard Technical Solutions Lab
    OpenGL FAQ: http://www.opengl.org/About/FAQ/Technical.html
                http://www.frii.com/~martz/oglfaq
 
 
 

1. I'm using a two pass rendering

Whoops, sorry about that subject.  One of the dangers of cut-and-paste.
Anyway, I have found an answer to my own question; I had a parameter
set wrong ... thanks, anyway.

                        -James

--
James J. Norton, Ph.D.
Digital Systems Branch (B32)
Naval Surface Warfare Center

2. StrataStudioPro novice ??

3. Two pass polygon clipper source for download.

4. Graphics of Books

5. Two-Pass z-Buffer Shadow Algorithm

6. W95 Game SDK

7. RIB pre-processing for render passes

8. SIGGRAPH class info?

9. Rendering out passes

10. Render passes

11. Multi-pass rendering relief: CompAssistant 2.1 released!

12. Multiple rendering passes (LW Mac)...not!

13. Rendering shadow pass only?