I wan’t to draw a horizontal line around object on Mouse Hover in the mouse position like the following image.
Please, help me how can i do it ?
Hi!
Modify your material, passing point of intersection, casted in object’s local space, in a uniform, then process this data in shaders.
For a reference, have a look at this forum topic: Creation of rays passing through a 3D model
I appreciate your kindness @prisoner849
I had a similar problem once, when I wanted to draw height isolines across a digital elevation model. My solution was a 1-dimensional data texture (aligned along “v”), which I cast horizontally against the terrain.
In your case, a 1x1 data texture would be sufficient, with the textures .wrapS set to THREE.RepeatWrapping and the texture’s .offset.y set to the desired height.
@Babak
Here is the example, whose gif is above: Edit fiddle - JSFiddle - Code Playground
I modified one of my previous examples, so names of variables may surprise
@vielzutun.ch
For isolines, I use this approach: Anti-Aliased Grid Shader - Made by Evan
Used it in this experiment with GPU raycast: GPU raycast - JSFiddle - Code Playground
Thanks again @prisoner849
This is exactly what I want
You’re very kind
Thanks for sharing!
The approach I proposed originates from the time before the advent of shaders. It’s sort of a “legacy” approach, without the need for shader writing.
Your two linked versions are obviously superior in that the isolines have a constant width, while my approach (while perfect when viewed horizontally) shows considerable variations in line width, depending on the slope of the terrain, when viewed from above.