Pryme8 Posted August 6, 2018 Author Share Posted August 6, 2018 So what you could do then is you need to have the GPU generate a heightmap texture using the same displacement algo that you are using. Change the shader from using your displacement algo to sampling the heightmap texture, and then you can cat rays from the sphere to the plane to establish the UV position. Convert the UV position into a pxl location, then identify the value of that pixel on the heightmap and transform the sphere accordingly. then you can also add a variable in your heightmap generator pass that can account for the sphere's impression into the water as well. Hope that makes sense? You will have to use a rtt. Just looked at the source for http://madebyevan.com/webgl-water/ and it looks like thats what he is doing. Using the GPU to generate the heightmap and then 'ping-ponging' it to simulate the water, Look up my GPU game of life simulation and it will show you how to set up the 'ping-pong' buffer setup. He is also raymarching the caustics I think. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 6, 2018 Author Share Posted August 6, 2018 8 minutes ago, Nabroski said: @Pryme8 their was an example the BabylonJs dude walking in a terrain. Based on Raypicking. That would work i think. But i can't find the playground anymore ... That was all CPU if I'm not mistaken. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 6, 2018 Share Posted August 6, 2018 yepp, kind of stupid question. but you never know. i guess it time to implement geometry and tessellation shaders, khronos really miss that one. also binary shaders and few other things we have to work with what we got. http://www.babylonjs-playground.com/#UVCI3B#4 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 6, 2018 Share Posted August 6, 2018 yeah thats nice http://madebyevan.com/webgl-water/ thank you for the link. not exactly, but good for study. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 6, 2018 Share Posted August 6, 2018 @Sebavan i feels like batch rendering matrix premultiplication. i have very simple test scenes. it is just disturbing. do you know a nice switch to turn it of? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 7, 2018 Share Posted August 7, 2018 you need gpu picking @Nabroski ? right Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 7, 2018 Share Posted August 7, 2018 I think this is gonna be my long term personal project.No, i think on BabylonJS side it would be best to work with a geometry shader. I really don't know why khronos decided to skip that one. This guy claims to have a working implementation: https://acko.net/blog/yak-shading/. So one possibility could be: displace on the GPU send the information as texture read the information from a texture buffer apply to a babylonjs mesh make collisions Yeah, let''s implement the hole missing WebGL stuff, sounds like fun. Also remands me of Transform feedback, just without the f e e d b a c k. Should be faster then read/write texture accesses. Pulling the data, without re - sending it, i actually don't no if this works. but i will give it a try at the weekend. @NasimiAsl If you have something interesting feel free to share. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 7, 2018 Author Share Posted August 7, 2018 5 hours ago, Nabroski said: This guy claims to have a working implementation: https://acko.net/blog/yak-shading/. Wow I love that guys website. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 8, 2018 Author Share Posted August 8, 2018 https://www.babylonjs-playground.com/#UUQJGM#1 I need some help keeping the "Scene" the same size when the output size changes. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 8, 2018 Share Posted August 8, 2018 Hello i would like to help, but i don't understand (as always) the problem. Can you rephrase. If i change the #renderCanvas an click rerun the jsEditor you scene looks good. So w a t do you mean with same size ? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 8, 2018 Author Share Posted August 8, 2018 https://www.babylonjs-playground.com/#UUQJGM#3 the Scene effective ratios change if the output size changes Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 8, 2018 Author Share Posted August 8, 2018 https://www.babylonjs-playground.com/#UUQJGM#6 Got it. I swear just posting my problem on here helps me visualize whats going wrong. Sorry If I end up talking to myself a lot... >_< Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 8, 2018 Share Posted August 8, 2018 i just you more on the save side (also project dependent) when you set the Vec2 to ViewportSize not canvas.width see here: https://computergraphics.stackexchange.com/a/5725/5950 now the thing is the vUV goes from 0 to 1. So you need ( as you allready figured out) a conversation. https://www.babylonjs-playground.com/#UUQJGM#7 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 8, 2018 Author Share Posted August 8, 2018 I was effectively doing a cubemap projection for the coordinate system and had to have my 'depth' coordinate be effected by the ratio as well. 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.