Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
help: reflection shader #207140
05/17/08 22:55
05/17/08 22:55
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
hello.

Wondering why there is no list of all the shaders here on the forum, that would save new posts. The wiki maybe has not every.

1- My question is: Where i get the shader effect for cube environment reflection...

But one, that plane faces of the cube reflection are correctly displayed, like a mirror, since i worked with some where plane faces would not reflect correctly, since in just one face model (ex: cube) (1 face 4 vertices) the reflection is wrong...

2- And for dinamic reflection.. is that hard one to get?
I remember there are old games that had it already, so, maybe its not a difficult thing or is it?




Pictures show that in some areas the shader is shrinked, and with simple faces, the (planar faces) bottom of the ship, the reflection is just one color, ( when it should reflect the environemnt cube)...


Any Idea?







Thanks!

Last edited by MMike; 05/17/08 23:12.
Re: help: reflection shader [Re: MMike] #207195
05/18/08 11:39
05/18/08 11:39
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
It's all about the normals of the model, if the vertices are connected, they get interpolated. So the cubes normals would give you some kind of sphere. The shading looks wrong, to avoid that you just have to select the option 'sharp' in MED, if you create a primitive.

Re: help: Cube reflection shader [Re: Scorpion] #207244
05/18/08 17:30
05/18/08 17:30
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Yes it looks wrong. I did in studio max. But what you mean is that i should not use smoothing group?

I tried with sharp edge and soft edge, and stills not a accurate reflection.

if i asign tha to a plane.. the reflection will catch the whole cubemap, and that can't happen, it should just show the view vector for that region..
O tryed with other environment shader from nvidea and it my model works the way i want to be reflecting.

-- And realtime is with render to texture correct?


Last edited by MMike; 05/18/08 19:39.
Re: help: Cube reflection shader [Re: MMike] #207262
05/18/08 20:08
05/18/08 20:08
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
correct, but cubic environment reflections are only realistic for very small spheres.

Re: help: Cube reflection shader [Re: Joey] #207265
05/18/08 20:16
05/18/08 20:16
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
ok so , how do i get a realist reflecting like those i see on shadercomposer or rendermonkey or etc.. or other games?

realtime is not necessary right now.. maybe later.

I just need a way to make a simple plane, reflect the word cubemap in a correct maner.
like this!:
Quote:
This is done with an environment map. The environment map is a texture resource which is accessed in the fragment program with a reflection vector to retrieve the reflected color. The incident vector is calculated by subtracting the fragments position from the eye position in world space. This vector is then normalized. The objects normal is then rotated into world space and normalized. The reflection vector is calculated using the reflect() standard library function with the incident and normal vector as arguments.

IMAGE


Last edited by MMike; 05/18/08 20:23.
Re: help: Cube reflection shader [Re: MMike] #207305
05/19/08 03:23
05/19/08 03:23
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Use a cubemap as a material skin, amking sure you convert it to a cubemap:

bmap_to_cubemap()


Then reflect the eye direction to the current pixel off of the normal

Then use tex3D() to do a texture lookup from a cubemap using the reflection vector.



Adding realtime support does not affect the shader, it's simply a matter of rendering the views of the visible sides of the cubemap.


xXxGuitar511
- Programmer
Re: help: Cube reflection shader [Re: xXxGuitar511] #207320
05/19/08 07:44
05/19/08 07:44
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
not tex3D but tex2Dproj is the correct sampling function.

Re: help: Cube reflection shader [Re: Joey] #207407
05/19/08 13:53
05/19/08 13:53
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
ok can someone contribute with a shader that will reflect the cubemap correctly even with plane surfaces.

Im not really in this shader field. Hope to learn it later.

And realtime reflection is a matter of simple script right.?

Thanks.

Re: help: Cube reflection shader [Re: MMike] #207416
05/19/08 14:33
05/19/08 14:33
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
tex3D is correct if your sampling from a cubemap...

tex2Dproj if your reading from one flat surface (also plausible for reflection)


xXxGuitar511
- Programmer
Re: help: Cube reflection shader [Re: xXxGuitar511] #207422
05/19/08 14:55
05/19/08 14:55
Joined: Sep 2002
Posts: 1,604
Deutschland
ChrisB Offline
Serious User
ChrisB  Offline
Serious User

Joined: Sep 2002
Posts: 1,604
Deutschland
I find it more convenient to use texCube for sampling a cubemap. I think tex3D is only for volume texture?

For the problems with plane surfaces: you could try to also use the vertex position to calculate the reflection vector instead of only the vertex normal. I think there was a paper about this on nvidia.com.

Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1