Jump to content

Geometry Shader Lighting


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

I'm getting mixed and seemingly random results with the lighting of my grass.  The line between light and dark moves with the camera.  This is what I'm passing out of my geometry shader to the default PBR fragment shader.  The grass is green as I'm setting the vertex color to green.  The fragment shader is just doing the lighting.  I've looked at the fragment shaders to see what it needed but might have missed something?

layout(location = 25 ) out uint outEntityID;
layout(location = 5 ) out flat uint outMaterialID;
layout(location = 8 ) out vec4 outVertexPosition;
layout(location = 1 ) out vec3 normal;
layout(location = 7 ) out vec4 worldPosition;
layout(location = 0 ) out vec4 vertexColor;

First it was this;

Grass_Lighting.thumb.png.cd21281125ffa82cdfebd82ca31c298c.png

Now at random it is this;

Grass_Lighting_002.thumb.png.7d9d02dac546f227b8298063d5ddbdcc.png

 

Link to comment
Share on other sites

Here are the inputs for the lighting function:

RenderLighting(material, materialInfo, vertexWorldPosition.xyz, n, v, NdotV, f_diffuse, f_specular, renderprobes, ibldiffuse, iblspecular);

 

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Oh, that reminds me.  Inside that function in Lighting.glsl, RenderLight() was using the input vertexWorldPosition rather than the argument "position".

RenderLight(lightIndex, material, materialInfo, vertexWorldPosition.xyz, normal, v, NdotV, f_diffuse, f_specular, renderprobes, ibldiffuse, iblspecular);

I thought it should use the argument 'position' seeing as it is passed to it but not sure... I don't know if it's something the user could end up editing in the UserFunction?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...