Closed Wenzy-- closed 5 years ago
I didn't implement ambient lighting, so you will have to modify the shader to add ambient lighting. This is where the final color is outputted to the screen:
You can add a variable for ambient color, for example:
// Remember to define Ambient variable
o.color = float4(Ambient + emission + PixelRadiance(data, indirectDiffuseRadiance), 1.0);
And use Shader.SetGlobalColor
or CommandBuffer.SetGlobalColor
to assign ambient color to Ambient
variable. The former method can be easily implemented in a MonoBehaviour script, while the later requires your knowledge in Scriptable Render Pipeline.
Thanks for your reply. That code you mentioned is very useful. I think you can consider intergrating it in the next version. It's convenient for the design tweaking.
But I remain some problems.This is the origin version by VXGI.There are some procedural mesh.Lighting is nice.
This is what I did as you said, add the ambient value.
But I think the result is easy to turn "gray" and "white",i mean the saturation is decrese.Is there other way I can add this ambient value?Maybe not use the simple addition.
I have try to add a scaleVal in it,like
o.color = float4(emission + PixelRadiance(data, indirectDiffuseRadiance * scaleVal), 1.0);
I think it just control the intensity of the second bounce.
This color and result is close to what I want in ambient light.To light the object. Do you have any suggestion where can I apply the ambient value?
I try this one below. It seems better
o.color = float4(emission + PixelRadiance(data, AmbientColor + indirectDiffuseRadiance * IndirectDiffuseRatio), 1.0);
According to the document, Unity does have interval shader variable for ambient lighting. You can check out the Fog and Ambient section. I didn't test that out, so you might have to give it a try.
But I think the result is easy to turn "gray" and "white"
First, check if you have set the project setting to use Linear Color Space. Secondly, the display can only display color in Low Dynamic Range. Therefore, to display HDR color correctly, we will have to implement tonemapping effect to map HDR color to LDR color.
As you can see, ambient color is just a constant. Back then, it was used to compensate for indirect lighting which was very expensive to compute. As a result, when you add ambient color to the image, it just feel un-natural. This is why I didn't implement ambient color in the first place.
I have added #23 which allows injection of environment lighting into the scene. The setting can be turned on or off in the render pipeline asset inspector.
I have tested.Very convenient and works well~
I have merged this into master branch.
Hi,Looooong.Your VXGI addon is great.But I don't know where to set the environmental lighting.In SEGI, I can go to the LightingSetting - envirment lighting - ambient color to set.But in VXGI this doesn't work.So the shadows are alway very dark.I can't make a bright environment~