PDA

View Full Version : Skybox works incorrectly in reflection rendering



TRam__
June 14th, 2015, 06:09 AM
I don't know but may it be its position is wrong? And what is that light-blue color between the skybox and trees?

http://i.piccy.info/i9/c9d15b11a4de7180745040137a01eea3/1434280134/64714/854143/Bezymiannyi_800.jpg (http://i.piccy.info/i9/c1e795d37dfd76bab4a6d13d91486583/1434280134/359450/854143/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-06-14-11-08/i9-8345395/800x423-r/i.gif (http://i.piccy.info/a3c/2015-06-14-11-08/i9-8345395/800x423-r)

In case of "base sky box" it should be gone at this angle at all (only sky has to be visible), but instead of that it grow down.

http://i.piccy.info/i9/f07fb339d87aae735f7b6ea75204bf9c/1434280719/24787/854143/Bezymiannyi_800.jpg (http://i.piccy.info/i9/88cccb7647362f18d1a48fd1cc2499ce/1434280719/96965/854143/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-06-14-11-18/i9-8345452/800x422-r/i.gif (http://i.piccy.info/a3c/2015-06-14-11-18/i9-8345452/800x422-r)

P.S. nevermind on "base sky box" colored black.

One more bug - the "horizont color" also doesn't affect on reflection
http://i.piccy.info/i9/35d99e8de466b9ce3584e90bf1798572/1434281489/35298/854143/Bezymiannyi_800.jpg (http://i.piccy.info/i9/65916eab5bf0196719135da69a82de98/1434281489/133715/854143/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-06-14-11-31/i9-8345497/800x421-r/i.gif (http://i.piccy.info/a3c/2015-06-14-11-31/i9-8345497/800x421-r)

TRam__
November 10th, 2015, 06:40 PM
Thump the thread up. Now it is the build 79199 and everything is still there.

I've disable all processing in "Water.fsh", except the sampling from pre-rendered "texture0". I.e. all these errors connected with pre-render.

So, first what we see, is a sky box, that ends up with "the blue end of world", and brown fog near the end of sky box.
http://i.piccy.info/i9/4d7b5fd74b3842c9fb2b86c508e7fb0c/1447197165/12028/961058/Bezymiannyi_500.jpg (http://piccy.info/view3/8994007/0e4adf1bb3333a9b15a0bf462f0af3cb/)http://i.piccy.info/a3/2015-11-10-23-12/i9-8994007/500x263-r/i.gif (http://i.piccy.info/a3c/2015-11-10-23-12/i9-8994007/500x263-r)

I can turn the environment settings, and everything stay there, i.e. the fog is still there and it is still brown, the blue end is also there
http://i.piccy.info/i9/8157920773c128e079e4fdf2237c278c/1447197314/13510/961058/Bezymiannyi_500.jpg (http://i.piccy.info/i9/ba76a3e0eba33aaec94f81e72a4cc2a6/1447197314/129222/961058/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-11-10-23-15/i9-8994010/500x259-r/i.gif (http://i.piccy.info/a3c/2015-11-10-23-15/i9-8994010/500x259-r)

That shows how environment settings are applied to pre-render. I.e. they are not applied, but should be...

Next, what we can see, that "fog" is not connected with the distance. I can't assume what is it connected with. May it be, the better idea is completly remove it ? Or, if it is possible, interconnect it with distance to the objects?
http://i.piccy.info/i9/05c956624eaafd210497301bfa8aa83d/1447197740/23417/961058/Bezymiannyi_500.jpg (http://i.piccy.info/i9/0634ce31acf11d851d788c56560ce177/1447197739/224418/961058/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-11-10-23-22/i9-8994015/500x264-r/i.gif (http://i.piccy.info/a3c/2015-11-10-23-22/i9-8994015/500x264-r)

This "fog" vanishes, if the camera is slitly upper the water surface:

http://i.piccy.info/i9/5b289eac11742e9de07480857d050f1a/1447198236/53925/961058/Bezymiannyi_800.jpg (http://i.piccy.info/i9/a4b4da166bae60b5c50121f583a67720/1447198236/233968/961058/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-11-10-23-30/i9-8994018/800x422-r/i.gif (http://i.piccy.info/a3c/2015-11-10-23-30/i9-8994018/800x422-r)

Also i don't know, why the underwater skybox "goes deeper" so quickly:
http://i.piccy.info/i9/c7afe59e949dce1af3b32e0ba8476410/1447198447/20336/961058/Bezymiannyi_500.jpg (http://i.piccy.info/i9/f7e4e1d4d8c6e892c0fb7bb021a28cfa/1447198447/206236/961058/Bezymiannyi.jpg)http://i.piccy.info/a3/2015-11-10-23-34/i9-8994019/500x264-r/i.gif (http://i.piccy.info/a3c/2015-11-10-23-34/i9-8994019/500x264-r)

A "physical correct" way will be to move it deeper with twice speed of "usual skybox" (relative to viewer, i.e. with same speed relative to water surface), but may be it will be more beautifull to save "underwater skybox" on the same level relative to water surface independently to viewer position...

i hope some of these bugs will be solved.

TRam__
January 23rd, 2016, 06:38 AM
So, the answer for "brown color" - it is usual fog, but the z-buffer works incorrectly or "vec4 reverseDepthParams" setted incorrectly during render-to-texture step. As for that light-blue color: it is "water of underwater" :Y:

http://i.piccy.info/i9/1f72f0a787722aa59d3c289d1bf22a9f/1453548720/23863/981584/2016_01_23_142919_800.jpg (http://i.piccy.info/i9/7d82e41f59a4ee2c7b2b6f674e211211/1453548720/118570/981584/2016_01_23_142919.jpg)http://i.piccy.info/a3/2016-01-23-11-32/i9-9307940/800x424-r/i.gif (http://i.piccy.info/a3c/2016-01-23-11-32/i9-9307940/800x424-r)
(picture of flipped V - coordinate of UVW )

A'm not telling about skybox colours, that still not setted...



P.S. heve checked that more correctly and realised that "that is original framebuffer color", i.e. there are no poligons and "SkyBoxBase" at all.

TRam__
January 23rd, 2016, 09:53 PM
Just that case when "if you want get something good, do it yourself".

The "blue background" resloves this code, added to SkyBox.vsh in function "void EditVertex":

#ifndef DEPTH_ONLY
if(viewCameraWorldPos.z < 0)
{
vec4 vPos = GetVertexPosition(vin);
vec4 vPos_world = mul(GetModelToWorld(vin), vPos);


if(vPos_world.z < (- viewCameraWorldPos.z))
{
vPos += 0.5 * viewCameraWorldPos.z;
vertex.screenPosition = mul(GetMVP(vin), vPos);
vertex.worldPosition = mul(GetModelToWorld(vin), vPos);
}
}
#endif // !DEPTH_ONLY

And the incorrect fog is removed with replacing in StdUtilities.fsh


float distance = DepthTexToViewDepth(GetNonLinearDepth(fin), reverseDepthParams);
with

float distance = reverseDepthParams.x / GetNonLinearDepth(fin);

I'm sutisfied :)

http://i.piccy.info/i9/de365b6cbe6e1061a1ecbd5e538b643a/1453604422/47694/981584/2016_01_24_055749_800.jpg (http://i.piccy.info/i9/738cd4f5aa5b5375247a85353ae14040/1453604422/236886/981584/2016_01_24_055749.jpg)http://i.piccy.info/a3/2016-01-24-03-00/i9-9310952/800x424-r/i.gif (http://i.piccy.info/a3c/2016-01-24-03-00/i9-9310952/800x424-r)


http://i.piccy.info/i9/bb32041967a0100c927d6e9839c0369e/1453603510/37865/981584/2016_01_24_054229_800.jpg (http://i.piccy.info/i9/ea69f7b76b6a5e83d9a3cc733a3b9985/1453603510/190496/981584/2016_01_24_054229.jpg)http://i.piccy.info/a3/2016-01-24-02-45/i9-9310951/800x424-r/i.gif (http://i.piccy.info/a3c/2016-01-24-02-45/i9-9310951/800x424-r)

WindWalkr
January 26th, 2016, 04:46 AM
Hi TRam__,

Thanks for continuing to look into this. I'm busy on other things at the moment, but I'll definitely get back to you on this when our priorities shift back in this direction.

Nice work,

chris

WindWalkr
February 16th, 2016, 01:07 AM
As far as I'm aware, this should be resolved in the latest internal build. Let me know if you have any remaining concerns.

chris