Jump to content

Using standard material and reflective texture on one surface


Bhupi
 Share

Recommended Posts

Hi.

I want to attach a standard material and a reflective texture on the same surface. I have jpg's for both. I tried to use multi-material:

                var ematerial = new BABYLON.StandardMaterial("wall_wood", scene);
                ematerial.emissiveTexture = new BABYLON.Texture("wall_wood.jpg", scene);

                var rmaterial = new BABYLON.Texture("wall_wood_r", scene);
                rmaterial.reflectionTexture = new BABYLON.Texture("wall_wood_r.jpg", scene);
                rmaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.PLANAR_MODE;

                var multimat = new BABYLON.MultiMaterial("multimat", scene);
                multimat.subMaterials.push(ematerial);
                multimat.subMaterials.push(rmaterial);

                mesh.material = multimat;

This did not work as expected.

How can I achieve this? Is custom shader the way to go?

Link to comment
Share on other sites

  • 3 weeks later...

We did not proceed this way (we removed reflection).

In general, for reflection to work, you need 3 things:

1: surface/mesh to reflect on: it can have texture

2: meshes/objects that need to be reflected: to be added in the renderlist of the mesh in point 1

3: light: should fall on the mesh in point 1

Link to comment
Share on other sites

49 minutes ago, Deltakosh said:

@leanderr can you elaborate on what you try to achieve? This seems not related to original question.

"I want to attach a standard material and a reflective texture on the same surface." (Original Question)

And Second I want to blend the Grid Material and a Standard Material with a certain Ratio / Alpha / Alphamap (from Grid).

Here are my Attempts so far. http://babylonjs-playground.com/#5S6MD#11

Link to comment
Share on other sites

I replied to first question already (just use a stdmaterial which support reflective texture)

For your second question: the grid material is a material and meshes can only have one material so you need to have two meshes with the second one transparent to simulate the blending. Multimaterial cannot be used here because it is not for blending. It is used when you want to have some part of the mesh with one material and some with another material

 

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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