Jump to content
YouGroove

Shaders reflections changes ?

Recommended Posts

I updated my project and the last changes made the PBR style shader only reflect in a side of the models with a strange reflection.

reflection.jpg

Share this post


Link to post

When decals were added I had to switch the material flags and specular values in the gbuffer.

Share this post


Link to post

Its because the default shader calculates the cubemap colors combined with the specular texture but then never does anything with that variable ('emissions'). Another thing to consider is that the texture slot for the cubemap is texture 5. Also, keep in mind that there is no default env shader for animated models.

Share this post


Link to post
Another thing to consider is that the texture slot for the cubemap is texture 5

I put one on texture 5 slot , but nothing happens.

I was seeking some reflective material effect for static models not animated.

 

LE3 is not able to have buidling windows reflective like this simple shader ?

How can we do ?

Share this post


Link to post

The cubemap goes on texture slot 5, and if you change the last line of the pixel shader to this, it will appear:

fragData2 = vec4(emission.rgb,specular);

 

It just doesn't get used in the default demos, so this got missed. Adding the fixed shader now...

Share this post


Link to post

I changed the last line, still the effect is very strange ad the reflections depends on the camera height or movement it makes on part reflective and another part not reflective.

 

Is there something specific i missed ?

post-3271-0-41545800-1443909599_thumb.jpg

post-3271-0-07542800-1443910412_thumb.jpg

Share this post


Link to post

Edit: Josh I think calculation for reflective cubemap is wrong.

 

line 63 and 64 :

 

 //reflectdir.y *= -1.0; //no need
cubecoord = reflect(cubecoord,reflectdir); //reflect cubecoord by reflectdir not the other way around

Share this post


Link to post

I applied your changes Shadmar, but the reflection is still depending on camera position sad.png

Also is the reflection half mixed with diffuse map or can we control in some way how much it reflects ?

post-3271-0-14865500-1443914403_thumb.jpg

Share this post


Link to post

That looks like smoothing problems. What happens if you recalc normals using 35 or 50 degree angle.

Share this post


Link to post

Another problem using a simple texture and normal map it makes artifacts depending on camera distance.

 

I am not a shader coder, i will just wait for some tested working version.

post-3271-0-45780900-1443954998_thumb.jpg

Share this post


Link to post

They are reflections, they are suppose to reflect environment when you move the camera.

Show me a video and your shader.

Share this post


Link to post

It is a problem with camera coordinates projection, ad we expect reflection on the whole surface.

 

Just do like me and copy and change some developper material to test it.

post-3271-0-83173800-1443968540_thumb.jpg

Share this post


Link to post

line 63 and 64 :

 

//reflectdir.y *= -1.0; //no need

cubecoord = reflect(cubecoord,reflectdir); //reflect cubecoord by reflectdir not the other way around

 

 

 

It works, thank you for your help Shadmar.

post-3271-0-28768200-1444062677_thumb.jpg

Share this post


Link to post

Some usefull modification to tweak models reflection power in the editor :

 

Change this line of code in LE3 Environment shader to be able to control the level of reflection using the specular material adjustable value.

 

vec4 emission = texture(texture5,cubecoord) * texture(texture2,ex_texcoords0) * materialcolorspecular ;

post-3271-0-65273800-1444068177_thumb.jpg

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...