Jump to content

Set texture per face of loaded mesh


yLacaute
 Share

Recommended Posts

I am stuck. And mad.

  • I don't mange to apply textures on loaded mesh (@Pryme8 I understand nothing to your PG which is too complicated for me to just set a f*#!#g texture, please note I am beginner)
  • I tried to apply 2 repeated textures on Blender : it works "inside blender" but when I export : i lose the repeat option

The video shared above show "a way of doing" by adapting textures to a shape : you build one image with all inside. I understand this can be useful for a complete object (a character for example) but I would like the opposite : I have a plane (with 2 faces) and each face should be attached to a texture (with offset and repeat option). As I already have a lot of textures, I want to exploit them and NOT create a new image containing existing texture. If many objects share the same texture, I load it many times, that has no sense for me. A solution could be to put ALL textures in a single image, but same, that is a crazy solution, the single image will become unusable (the hell to edit it).

Currently, I fail on the simplest possible export :

  • Blender > new plane
  • Blender > add material > add texture from image > repeat x = 2
  • Blender rendering : it works
  • Export
  • Babylon > load > I see my texture, but without repeat option

I can't find any good tutorial for basic things... please help :blink:

My objectif is still the same as the first comment here : get a plane with 2 faces with 2 different textures applied (but now textures are directly applied in Blender instead of in babylonjs)

Link to comment
Share on other sites

@Pryme8 I am using physicImpostors so I try to limit the number of mesh for performance, that's why I did not 2 planes :)

I just succeed to import a plane from Blender, with 2 textures on it with repeat option. But there is something strange :  the rendering in Blender is not the same than in BabylonJS. I played with the size property to repeat the textures (as explained here http://doc.babylonjs.com/resources/blender#textures) but the result is that the exported file is not exactly the same as the rendered view in Blender. See attached images.

@Deltakosh You applied materials on a mesh created with Babylon, and all problems are coming when you applied materials from an imported mesh : you can't do the same as in your PG from what I have understood.

 

babylon_render.jpg

blender_render.jpg

Link to comment
Share on other sites

12 minutes ago, yLacaute said:

@Pryme8 I am using physicImpostors so I try to limit the number of mesh for performance, that's why I did not 2 planes :)

I just succeed to import a plane from Blender, with 2 textures on it with repeat option. But there is something strange :  the rendering in Blender is not the same than in BabylonJS. I played with the size property to repeat the textures (as explained here http://doc.babylonjs.com/resources/blender#textures) but the result is that the exported file is not exactly the same as the rendered view in Blender. See attached images.

@Deltakosh You applied materials on a mesh created with Babylon, and all problems are coming when you applied materials from an imported mesh : you can't do the same as in your PG from what I have understood.

 

babylon_render.jpg

blender_render.jpg

try
mesh.material.diffuseTexture.uOffset = 0.5;

Looks like the offsets are different for some reason.

Link to comment
Share on other sites

18 minutes ago, Deltakosh said:

This is the point here: why is it not working on a mesh imported from blender? does it have more faces?

That is exactly why I opened this topic : why ? :D
Here is the PG : https://www.babylonjs-playground.com/#JQDPT6#6
You can see it is easy to put a texture on a Babylon box, not in an imported plane from Blender.

Keep in mind I am still speaking with a newbie langage, when i speak about "face" I speak about "face I I can select in blender" not "triangle" (So in the PG above, the plane is composed with 2 rectangular faces, but more triangles)

Link to comment
Share on other sites

So your wall object does not have uvs so you need to generate one set per vertex so 36 values (I saw that you tried to generate one per index but it is one per vertex)

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