How is it possible to draw a circular texture to the spot where the mouse is pointing.
For example, to mark the place where you drop the bomb? Or mark a player? As pictured below
It can be done without using a shader? For example, rendering to a texture?
Terrain highlight - under mouse cursor
Re: Terrain highlight - under mouse cursor
If your ground is flat, the easiest way is to place a quad at 0.01 y, textured with that circle.
-
- Posts: 11
- Joined: Mon Jan 11, 2016 7:17 am
Re: Terrain highlight - under mouse cursor
If I'm right, it will not look too good for example on the hills, where it will fade texture inside the mountain?
Re: Terrain highlight - under mouse cursor
Your picture had no hills. With rugged terrain, you should use a shader.
Re: Terrain highlight - under mouse cursor
Otherwise search the web for "decals". There is a decals solution in irrExt, but I just took a quick look and unless I've missed it (just spend half a minute quick-browsing the code) it didn't look like it can handle hills. So to make it look good you probably have to do it yourself. Basic idea is probably - project it only on floor. Use some way to get floor polygons fast (octree in Irrlicht, but not optimal for floors, quadtree or grid will both work better, but start with ISceneManager:: createOctreeTriangleSelector for least work). Collide a boundingbox of your decal (your texture) which is slightly extended in height against the floor polygons at that point. Then clip those floor polygons against that box. Create a mesh with those clipped polygons. Think careful about the uv's you need now.
Then draw those polygons slightly (tiny +y value) above the floor.
Post the code once you are done for bonus points :-)
Then draw those polygons slightly (tiny +y value) above the floor.
Post the code once you are done for bonus points :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 1010
- Joined: Mon Oct 24, 2011 10:03 pm
- Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d
Re: Terrain highlight - under mouse cursor
there are a few ways to do it - use a shader to project the texture over the X/Z plane in question is a simple extensible solution.
you could also project decals over it, - for every problem there's probably at least a dozen solutions (you could sample the heighfield and build an overlay mesh but it may be relatively poly dense) - in addition splat mapping should likely work, a megatexture would work too although it would be relatively computationally expensive to update in realtime - the benefit is that all decals would bake to the megatexture and would have a fixed vram and drawcall cost. (NOTE: irrlicht may or may not support megatextures, and you may or may not get legal trouble for using the technique - I'm not too sure about the patents for it and whether or not you could get sued for using it)
you could also project decals over it, - for every problem there's probably at least a dozen solutions (you could sample the heighfield and build an overlay mesh but it may be relatively poly dense) - in addition splat mapping should likely work, a megatexture would work too although it would be relatively computationally expensive to update in realtime - the benefit is that all decals would bake to the megatexture and would have a fixed vram and drawcall cost. (NOTE: irrlicht may or may not support megatextures, and you may or may not get legal trouble for using the technique - I'm not too sure about the patents for it and whether or not you could get sued for using it)
"this is not the bottleneck you are looking for"