Multitexture but partially rendering onto a single mesh

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
realmsinthemists
Posts: 28
Joined: Mon Mar 27, 2017 7:29 am

Multitexture but partially rendering onto a single mesh

Post by realmsinthemists »

Hello again

is it possible with irrlicht to render a texture onto a mesh partially where it fades into another texture. e.g.: a terrain with grass, dirt, rocks etc.

looking at the ITerrainSceneNode example there are two textures which are rendered onto the mesh on to of each other and covering the entire mesh.

r,
For my end result I am working on:
- Volume Voxel System
- Simple light weight physics engine
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Multitexture but partially rendering onto a single mesh

Post by CuteAlien »

It should be possible with the EMT_LIGHTMAP_LIGHTING materials. If those are not enough it's easiest to code a shader for it (which also gives you more control). There are some restrictions about the amount of different texture coordinates you can use per vertex (1 with S3DVertex, 2 with S3DVertex2TCoords).
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
realmsinthemists
Posts: 28
Joined: Mon Mar 27, 2017 7:29 am

Re: Multitexture but partially rendering onto a single mesh

Post by realmsinthemists »

The day that I will use shaders is coming closer each day.

Using the materials I thought I could do some fast set up for basic materials. A quick look tells me not only the example show two textures but there can be only two textures at all for this. Quite limiting. Ah well, that one day is coming closer and closer at a logorithmic way.

Still I'dd like to ask, for a quick set up, how would I use EMT_LIGHTMAP_LIGHTING for three, four or more textures on the same UV set on a mesh?

e.g. for a vertex;
if
y > 192; snow
y > 160; rocks
y > 128; grass
y > 96; dirt
else
sand

in real time a better algorithm will be use for spots rather then based on heights.
FYI: I will use it for a volume voxel mesh
For my end result I am working on:
- Volume Voxel System
- Simple light weight physics engine
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Multitexture but partially rendering onto a single mesh

Post by CuteAlien »

For more than 2 textures you need shader materials. The default-materials only support 1 or 2 textures.
If you have questions about shaders there will be several people here in the forum who can help you.

Maybe start by browsing around https://www.shadertoy.com to get an idea how shaders look like. Those are glsl pixelshaders I think. When reading the code the idea you have to keep in your head is that this code is run for every pixel on the screen in parallel. Irrlicht also has a bunch of GLSL Shaders (for ES 2.0) in the ogl-es branch in media/Shaders... those basically simulate (more or less...) the Irrlicht default materials (those which are used in other drivers which have a fixed function pipeline).
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
Post Reply