thrice Posted September 1, 2017 Share Posted September 1, 2017 So, I'm trying to convert a shader from shadertoy, I'm close but still can't get it working. Also in my actual scene it doesn't seem to be working at all, but it's hard to tell if it's related to the issue I am having w conversion, since I need to rotate the sphere to get it to show up to begin with. Shader is here: (it appears blank at first, but if you rotate it youll start to see the fire. The actual effect I am going for you will see only if you rotate it just right so that you see the fire starting with the white in the middle, and it filling up the sphere). http://cyos.babylonjs.com/#M11GKA The source shader is here: https://www.shadertoy.com/view/lsf3RH So the one place I was not sure how to proceed, was mapping over the iResolution variable (which shadertoy states is the viewport resolution). I played around with a bunch of different things and ended up trying the camera input, which works, but requires rotating the mesh to see it at all. Anyone know what input would map over to viewport resolution (or how to get it), and or what I am doing wrong/missing here? Quote Link to comment Share on other sites More sharing options...
Taz Posted September 2, 2017 Share Posted September 2, 2017 Hey there. iResolution is being used to normalize the fragment's coordinates, to be in the range 0 to 1. You can use vUV.xy in place of (fragCoord.xy / iResolution.xy), vUV is already in the 0 to 1 range. Also you don't need the x*=x/y part since you want to fill the whole texture (you can experiment with commenting out that line on ShaderToy to see how it will fill the whole screen). Here's a fork of your demo to show what I mean. I changed only the line that calculates p and removed the x*=x/y line. Quote Link to comment Share on other sites More sharing options...
thrice Posted September 3, 2017 Author Share Posted September 3, 2017 On 9/2/2017 at 1:12 PM, magig said: Hey there. iResolution is being used to normalize the fragment's coordinates, to be in the range 0 to 1. You can use vUV.xy in place of (fragCoord.xy / iResolution.xy), vUV is already in the 0 to 1 range. Also you don't need the x*=x/y part since you want to fill the whole texture (you can experiment with commenting out that line on ShaderToy to see how it will fill the whole screen). Here's a fork of your demo to show what I mean. I changed only the line that calculates p and removed the x*=x/y line. @magigAhhh! Thanks a ton! This shader stuff is intense, still trying to wrap my brain around it. 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.