How do I achieve a ”Fog of War” – Shader or Texture?

Removing it from the scene would use less resources…

@Wasserleiche said: But what black texture do you mean? Which one of the 3 possible terrain textures do you use? Or what do you mean by "overlaying a black texture"? I really don't get how you are doing this.

The 1st channel is used for the texture DiffuseMap_0.
The 2nd channel is used for the texture DiffuseMap_1.
The 3rd channel is used for the texture DiffuseMap_2.
and … the 4th channel is used for the texture DiffuseMap_3. :wink: And I just used a black texture there.

@destroflyer said:
@Wasserleiche said: But what black texture do you mean? Which one of the 3 possible terrain textures do you use? Or what do you mean by "overlaying a black texture"? I really don't get how you are doing this.

The 1st channel is used for the texture DiffuseMap_0.
The 2nd channel is used for the texture DiffuseMap_1.
The 3rd channel is used for the texture DiffuseMap_2.
and … the 4th channel is used for the texture DiffuseMap_3. :wink: And I just used a black texture there.

Are we using the same version? Terrain.j3md doesn only have 3 textures and the alpha map texture. What am I missing here? g

I’m using stable RC2 and the material definition Common/MatDefs/Terrain/TerrainLighting.j3md. :wink:
(It supports up to 16 textures I think, never looked into the source - There was an article about it)

@zarch said: Removing it from the scene would use less resources....

And if instead I just hide it with cull hint always?

Must have missed that you use TerrainLighting.j3md ^^".
So far so good. Now I need to manipulate my alphamap. How can I do that? This PaintableImage class from your link creates its own Texture from scratch, but I want to load an existing alphamap texture and manipulate its alpha values at certain coordinates. Can you actually access this data like PaintableImage does?

I don’t have any solid knowledge here but I would expect its still getting updated, calculated, etc each frame - potentially sent to the graphics card, etc. At the very least it needs processing each frame to check the cull hint! One of the core devs should know in more detail…

@Wasserleiche said: Must have missed that you use TerrainLighting.j3md ^^". So far so good. Now I need to manipulate my alphamap. How can I do that? This PaintableImage class from your link creates its own Texture from scratch, but I want to load an existing alphamap texture and manipulate its alpha values at certain coordinates. Can you actually access this data like PaintableImage does?

PaintableImage is obsolete.

Look at ImageRaster in core and if you need more facilities then the ImagePainter plugin.

@zarch said:
@Wasserleiche said: Must have missed that you use TerrainLighting.j3md ^^". So far so good. Now I need to manipulate my alphamap. How can I do that? This PaintableImage class from your link creates its own Texture from scratch, but I want to load an existing alphamap texture and manipulate its alpha values at certain coordinates. Can you actually access this data like PaintableImage does?

PaintableImage is obsolete.

Look at ImageRaster in core and if you need more facilities then the ImagePainter plugin.

Omg thank you so much! That was the last missing piece. Finally I can implement this :slight_smile:

Actually, I just looked at the PaintableImage class too see the how the basics are donw (Buffers etc.) - I’ve made my own “Painter” class with functionalities like loading existing images, changing values, drawing things etc… :slight_smile:

@destroflyer said: Actually, I just looked at the PaintableImage class too see the how the basics are donw (Buffers etc.) - I've made my own "Painter" class with functionalities like loading existing images, changing values, drawing things etc.. :)

That’s what ImagePainter does. It also (via ImageRaster) supports all the various different Image formats etc as well, for example you can seamlessly paint an Image in one format into one in a completely different format.

Take a look at it and if you have any features in your class that are missing from ImagePainter I’d be happy to add them.

Hi, I’ve done it using ImagePainter, and a simple LightMap. Works nice and easy.
Many thanks for your input !