Jump to content

MixMaterial problems


Recommended Posts

Hello @Luaacro,

First of all, thank you for this new material.¬†ūüĎć

To follow the discussion on the PR, I still have the problem with mixTexture1 and mixTexture2 that mix. I still have also the problem with alpha channels that do not draw textures but a light shade or very dark.

The idea was to have a mix with the diffuseTextures, but not with the mixTextures because the effect obtained does not give the desired result.

For you to understand better, I add my terrain editor online for you to test and see the result live :

Demo Terrain Editor (I can send you the full zip if you need.) I intend to offer this complet terrain editor for Babylon, I think it can be useful to many people.

Use :

  1.  select the terrain 'Delos' in the menu Load :
  2.  Activate edition mode (red button)
  3.  Select Painting mode to paint textures in the terrain.
  4.  select the texture one by one and paint.

We can see that the textures is a mix between diffuseTexture1 with diffuseTexture5,  diffuseTexture2 with diffuseTexture6, diffuseTexture3 with diffuseTexture7, diffuseTexture4 with diffuseTexture8 (mixTexture1 and mixTexture2 are mixing according to their RGBA channel)
We can also see that it is not possible to paint sand, it is simply transparent shadows or very dark. (I try material.alpha 1.0, but that does not change anything.)

try to paint snow on the mountain and repaint some rock over the snow. the snow remains apparent.

The shadows, Fog and lights work perfectly well.¬†ūüėä

Thank you for your help.

Screenshot result :


Link to comment
Share on other sites

The mix is better, yes.

1) The problem for alpha channel 4 and 8 still does not work properly. (no textures).  I try to make a white or black color, the alpha erases either the mixMap1 or the mixMap2.

2) There is also serialization problem with a terrain using MixMaterial and also TerrainMaterial. See this topic with PGs

Merci Luaacro

Link to comment
Share on other sites

I tried to modify the mixMaterial shader by setting the alpha to 1.0. the result is that it will create a single texture across my mix map and erase other RGBs and take into account only the mixMap2.

I think that the alpha channel does not allow to paint a texture by keeping the other 6 textures.

So, I was wondering if we should not create a third mixMap of ways to make 3 * 3 diffuse textures for 9 textures with RGB mix and let the alpha has 0 on the 3 mix map.

What do you think @Luaacro ? you think a third mixMap is possible to make 9 texture with RGB mix?

Link to comment
Share on other sites

Yes that must be it. I do not really know. Channel 4 (grass) and 8 (sand) make a transparent texture. (or rather erases RGB textures)

It does not happen. and if I invert the color (white instead of black) it draws a black color and no textures.

There on my editor channel 4 is white and channel 8 is black.

I can not understand how to use this alpha channel.

I did a color inversion alpha on the editor so you better see what I mean.

PS: I just corrected channel 4 (it miss the white color texture to paint) :)

Link to comment
Share on other sites

I just had an improvement with other tests. Rather than painting black or white, I put transparency on mixMap, and it works. The mellange of 8 textures works so.

The problem I have now is to paint with a transparent texture. I do not know how to paint transparency ? ideas ?

Link to comment
Share on other sites

@Luaacro : Ok, I managed to paint transparency. For this to work, mixMap2 must be all black at first, to make mixMap1 appear first. The 4 and 8 texture works now.

On the other hand, there remains a detail at the level of the layers of paint. If I paint on the mixMap1, everything is ok, then on the mixMp2, it works well too, but if I do the opposite, I paint the mixMap2, then mixMap1, it does not work. MixMap2 is always above mixMap1.


I updated the field editor with all the fixes. We can see that it works a little better. For example, try painting snow and then painting rock over the snow. It will not work. On the other hand the opposite works if one paints rock, then snow on top.

Editor of terrain

Link to comment
Share on other sites

Excellent! Just tested and it works really well :)

For your problem: in the shader, the mixmap 1 mixes the 4 first textures. The mixmap 2 mixes the 4 last textures with the first mix from mixmap 1.

When you paint using the mixmap 2, don't forget to clear the mixmap 1 by reseting the values to (0, 0, 0, 255) where you are painting. Do you see what I mean?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...