Getting world position of drawn pixel.
211 last edited by
I am trying to compile the following effect. There is a 3D world formed by many sprites faced the same direction (camera from the front). User click somewhere into that 3D space which should initiate world mutation onto another world. You can imagine that as that user can click on a water which should initiate a water deplenish process. On the end of the water deplenish process there would be world without water.
When user click somewhere in the 3D world the change to the world should begins to spread from that place. This would be done by simply computing a distance of drawn pixel from the click position and attach the sphere radius to some input value. The sphere surface would represent where the mutation is happening.
Now, I was unable so far to get a world position of drawn pixel as an input value in Shadero. Also if i would get that value, is there a method to compute a distance between two 3D positions?
This is shader I am currently working on for my Indie game project. I was working with Shader Forge before I discovered Shadero. Using Shadero seems to really speed up things as many usefull computations are already done for you but I am still missing some access to some basic inputs in compare to Shader Forge. Thanks for any suggestions / thoughts!
211 last edited by
All right I think I have found a partial sollution, but won't go for it as it seems to be a lot complicated. You can get world position using World Position Plus UV which would give you a world position of drawn pixel of selected X/Y/Z plane. You can combine 2 World Position Plus UV to construct 3D world position. From here I would need to compute a distance to the click position which would be not a pleasant without operators like square root etc. I am giving up on this effect and just go for some premade one.
Anyway here is my sollution to extract world position (not sure to be correct)
Vetasoft last edited by
Thanks for the suggestions :)