For squared version, you can store DistRatio * gExpFogDensity in the separate variable, and use exp(-var * var) instead, that will save you one multiplication.
@OGLDEV
2 жыл бұрын
True, though the shader compiler may be able to deduce it and optimize on its own.
@michaellundgren6949
2 жыл бұрын
One suggestion is to lengthen your end card on the video so the youtube links don't obscure the comparisons at the end.
@OGLDEV
2 жыл бұрын
Thanks. I pushed it further so it's only on the outro slide.
@cheerwizard21
Жыл бұрын
Hell yeah! Thanks for tutorial! I will definetely check this and few other books.🙃
@OGLDEV
Жыл бұрын
Thanks!
@catalyst1755
2 жыл бұрын
Hello! Could you further explain the implementation of volumetric clouds? I have seen very few demo programs and explanations on this subject. I think a lot of people would like to know how to add beautiful and realistic clouds to the world.
@OGLDEV
2 жыл бұрын
This is indeed a good topic though probably requires more knowledge build up. I'll see if I can find a good reference for it.
@EgorChebotarev
Жыл бұрын
not bad useful video and book sure too
@OGLDEV
Жыл бұрын
Thank you
@jefferyduncan162
5 ай бұрын
Probably going to be a silly question but, I’m trying to implement fog post lighting with deferred rendering. How can i set the clear color to be the same color as the fog without it affecting the lighting calculations? If I set the clear color to anything but black it affects the light pass color results.
@OGLDEV
4 ай бұрын
The question is definitely not silly it's just that I'm not sure I understood it. Are you implementing fog as a separate pass? Why do you need to change the clear color?
@jefferyduncan162
4 ай бұрын
@@OGLDEV thanks for responding back. I ended up figuring out the issue sort of and working around it. I’m doing my fog in a separate pass and If the position was equal to 0 (which for some reason it is where no geometry is present), the shader was discarding in those places. I needed to get the fog color to cover those areas since some parts of the map if occluded were showing the clear color. I did a small branch and checked if the position is 0. If so I wrote the fog color and it fixed the empty parts of the map being black instead of being the color of the fog. Screen space reflections up next 😁
@OGLDEV
4 ай бұрын
Great!
@ValeriCFBG
2 жыл бұрын
Exponential squared looks best, IMO. By the way, for something like a linear fog, can't we use the Z value of the vertex and check whether it is in the fog range and then use it as a Step for the LERP?
@OGLDEV
2 жыл бұрын
You mean in world space? No, because the value can be in the thousands or more. It has to be relative to the camera. So either transform it to view space first (where you can use Z) or use the distance from the camera in the world.
@ValeriCFBG
2 жыл бұрын
@@OGLDEV Roger that! So is the distance from the camera to the world in normalised coordinates?
@OGLDEV
2 жыл бұрын
Initially, no. We have the world space position of both the camera and the pixel. At this point you can use the actual distance or you can just take DeltaZ which is probably more performant. We divide it by the range from the minimum to the maximum distance and this normalizes it.
@ValeriCFBG
2 жыл бұрын
@@OGLDEV Ah ok! I meant the delta Z approach you mentioned, but could not explain it well. Thanks!
@babylongate
Жыл бұрын
Thank you, just can you tell me where is the gColorMod is? How to define or declare this I can’t find or I can’t make it available for my code, I have my own version using glfw how to know where is coming from that gColorMod ? Thanks bro
@OGLDEV
Жыл бұрын
I'm using gColorMod and gColorAdd for debugging and to enhance the color in my thumbnails (multiply the final color by gColorMod and add gColorAdd). You can find these uniform variables here: github.com/emeiri/ogldev/blob/master/Common/Shaders/lighting_new.fs They are not part of the actual technique so you don't need them in your shaders.
Пікірлер: 24