gamefan Posted June 15, 2016 Share Posted June 15, 2016 Hi again forum, From the many great features I have learned, I think that render target texture is the best thing I have come across yet. The ability to produce dynamic live reflections is really awesome. But there is one thing that bugs me. And yes, I have a playground too http://www.babylonjs-playground.com/#1NP9BY You will see I have added a cube to the reflection and refraction playground. While the reflection in the sphere looks realistic, in the cube it doesn't. As you will move the camera away from cube, the size of the clouds don't change. It always renders the same amount of texture(the sizes of the meshes in the renderList don't change) regardless of where the camera is from the mesh. Compare that to a mirrorTexture , once you have the mirrorPlane defined, the reflection is lifelike. Moving away and close to mirror gives accurate results. Is there some setting to have the cube texture behave like that on a cube? Quote Link to comment Share on other sites More sharing options...
adam Posted June 15, 2016 Share Posted June 15, 2016 I've noticed this too, but I thought it was just a limitation that we have to live with. It would be great if there was a fix for this. gamefan 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 15, 2016 Share Posted June 15, 2016 The cubemap you are using is centered to origin and not dynamic. For more realistic results, you'll need to either use mirrors (better suited for plane surfaces) or use dynamic cube map. Quote Link to comment Share on other sites More sharing options...
adam Posted June 15, 2016 Share Posted June 15, 2016 Isn't this a dynamic cube map? http://www.babylonjs-playground.com/#KA93U#84 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 15, 2016 Share Posted June 15, 2016 This one is not the one linked by the op. This will only fix the accuracy and not the plane distance issue (where mirror is better suited) Quote Link to comment Share on other sites More sharing options...
adam Posted June 15, 2016 Share Posted June 15, 2016 26 minutes ago, Deltakosh said: This one is not the one linked by the op. I know. I just thought that you said that the issue could be fixed by using a dynamic cube map. So the only fix is to use mirrors. Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 16, 2016 Author Share Posted June 16, 2016 @Deltakosh Dynamic cube maps are those generated by reflection probes? I am using them but the distance issue is there on them too. Using mirrors is alright for planes but for complex geometry it becomes really difficult. If the cube maps some how gave mirror like results it would be the NEXT LEVEL. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 16, 2016 Share Posted June 16, 2016 But to be honest I do not see waht can be done differently..Can you better explain what you would like to achieve? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 17, 2016 Share Posted June 17, 2016 i start fixing this problem i see exactly what you need not good result but after fixed i correct defaultpixelShader adam 1 Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 17, 2016 Author Share Posted June 17, 2016 @Deltakosh May be I will better be able to explain with another playground. Allow me some time to make one. Currently caught up in work. What I want is that complex geometries(like cube) and not just planes have real time true to size reflections with probes(cubeTexture). I am not sure if this is even theoretically possible, but any result close enough would also do. Currently cubeTexture is the best thing I can see for doing this, but it doesn't scale based on mesh's distance from camera. @NasimiAsl Great. I am eager to see the results. GameMonetize and dbawel 2 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 18, 2016 Share Posted June 18, 2016 22 hours ago, gamefan said: I am eager to see the results. @gamefan http://www.babylonjs-playground.com/#1NP9BY#10 see this and say is that your wanted result or not ** this is not final answer http://www.babylonjs-playground.com/#1NP9BY#11 description : new Reflect Shader : i comment with [new changes] all i change vec3 direction = normalize( wpos /*world position*/ * 3.141592 /* [new changes] PI */ *length(camera-wpos) /* [new changes] append this part for control zoom in reflect */ *0.01 /* [new changes] i dont know why this is 0.01 :) i try some number and find this */ -camera); vec3 coords = reflect(direction,nrm) ; vec3 cubeUV = vec3(refMat*vec4(coords,0.)); result = textureCube(cubeRef_0,cubeUV,0.); about "0.01" this is very lovely parameter it work same as perspective of reflect i think if we can find any relation between camera fav and this it can be make a reality result jerome, adam and dbawel 3 Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 18, 2016 Author Share Posted June 18, 2016 @Deltakosh I have a playground: http://www.babylonjs-playground.com/#1NP9BY#13 There are two large cubes one with reflection probe and one with mirror Textures. Its difficult to explain in words. The reflection (or at least perceived) in cube with probe reflection, gets bigger and bigger as the camera moves away from the mesh. I think whatever cubeTexture is doing here ,it should be doing the inverse. Try to see the reflection of small cubes on both the large ones. @NasimiAsl I think this is close. Still not exactly like mirror but convincing. I have created a plane mirror beside the mesh you made for compare. Can I use this with cubeTexture made from probes? And by the way your playground is so Disco. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 18, 2016 Share Posted June 18, 2016 i think this post is solved just need approved by some BJS leaders to move the defaultShader anyway maybe i am wrong. cheers Nasimi asl Quote Link to comment Share on other sites More sharing options...
adam Posted June 18, 2016 Share Posted June 18, 2016 @NasimiAsl will your solution reflect meshes in the renderList? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 20, 2016 Share Posted June 20, 2016 i think this task need correct DefaultPixelShader ( @Deltakosh most be look it before ) after that we can talk about mirror all depended for reflection Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 20, 2016 Share Posted June 20, 2016 @NasimiAsl can you provide a PR with fixes for default shader? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 20, 2016 Share Posted June 20, 2016 ok wait for me 2 or 3 hours Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 20, 2016 Share Posted June 20, 2016 Excellent! Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 20, 2016 Share Posted June 20, 2016 @Deltakosh See The Result : a: http://www.babylonjs-playground.com/#1NP9BY#15 when you zoom with mouse reflect don't be changed b: http://www.babylonjs-playground.com/#1NP9BY#16 this is Old Version of Reflection zoom and look the Box reflect My changset : BABYLON.Effect.ShadersStore["defaultPixelShader"] = BABYLON.Effect.ShadersStore["defaultPixelShader"].replace("vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW)", "vReflectionUVW=computeReflectionCoords(vec4(vPositionW*3.141592653589793*length(vEyePosition - vPositionW)*0.01,1.0),normalW)"); i think this fix Mirror Wrong size Problem gamefan 1 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 20, 2016 Share Posted June 20, 2016 @Deltakosh wait i need test more http://www.babylonjs-playground.com/#KA93U#150 : mirror sample vReflectionUVW= vec3(mat4(-1.,0.,0.,0.,0.,-1.,0.,0.,0.,0.,-1.,0.,0.,0.,0.,-1.)*vec4( reflect(normalize(vPositionW.xyz*3.141592*length(vPositionW-vEyePosition)*0.13 -vEyePosition.xyz),normalW.xyz ) ,0.)) ** where are computeReflectMatrix Uniform in DefaultPixelShader? ** and i don't know about last parameter yet it is close to 0.13 for mirror in this sample why adam 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 20, 2016 Share Posted June 20, 2016 We can't use arbitrary values like 0.13 We need to understand why you need it NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
adam Posted June 20, 2016 Share Posted June 20, 2016 I'm having a hard time telling difference between .13 and nothing (1). http://www.babylonjs-playground.com/#KA93U#151 I guess I needed to reload the page. Quote Link to comment Share on other sites More sharing options...
adam Posted June 20, 2016 Share Posted June 20, 2016 Here it is set to .75: http://www.babylonjs-playground.com/#KA93U#154 .5: http://www.babylonjs-playground.com/#KA93U#152 .1: http://www.babylonjs-playground.com/#KA93U#153 .05 http://www.babylonjs-playground.com/#KA93U#167 zoom level? Quote Link to comment Share on other sites More sharing options...
adam Posted June 20, 2016 Share Posted June 20, 2016 It seems to have issues if you move the cube away from the center. http://www.babylonjs-playground.com/#KA93U#155 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 20, 2016 Share Posted June 20, 2016 Yes We Need Know About That .That is like Perspective parameters Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.