I have textures on babylon.js
And I use example Babylon.js Playground with my custom map.
And I want a similar effect to be on the texture when hovering over it with the mouse in certain coordinates, for example:
So that it is not a selection of an area on the canvas with the help of CSS I wont a real selection 3D area.
Welcome to Babylon! I think probably the best starting point will be this Playground, which illustrates a way to move objects around a plane in accordance with the cursor.
Drag Demo | Babylon.js Playground (babylonjs.com)
From this starting point, all you should have to do is make your selection asset (an object or perhaps a light) follow your cursor even when it isn’t clicked, and how it looks will be determined by the selection asset you choose. Hope this helps, and best of luck!
The simplest way I think is use decals. See the following example: https://playground.babylonjs.com/#1BAPRM#73
My terrain uses a custom build shader material. So I used a different more dynamic approach by using dynamic texture: First, depending on mouse hover location, I decide what shape to draw on the dynamic texture. I then provide the texture as a uniform to the terrain’s shader material. Finally, in my fragment shader, I blend the dynamic texture with the base color for the terrain.
If you look through the playgrounds you’ll find various versions with different textures