- Home /
Question by
marius.treu · Dec 02, 2012 at 11:29 AM ·
shaderglsl
GLSL shader - circular gradient
Hi,
what I'm trying to implement is to cast out a ray that hits an object. This object has a shader attached, that should calculate the hit position and draw a circle around on the texture with a gradient fading out.
My problems now are: 1.) how to get the hit position 2.) how to draw a circle around on the hit positions texture
I've made a screenshot of the UV-map + the model.
Kind regards, Marius
Comment
Best Answer
Answer by whydoidoit · Dec 02, 2012 at 11:35 AM
Well you can get the hit position from hit.point in the RaycastHit structure returned by the raycast. You would then feed that into the shader and have it calculate the color of the pixels around the point using the CG length(pixel - hitPointFedIn).