Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi Niko. Merry christmas and happy new year. I have a custom mesh and i am trying to put the light map material on it. The lightmap is created with the 3d studio max baked textures and i tried 256x256 size images with png and jpeg formats but it seems that copperlicht is not loading it (i can see it black). Here is the part of the code i am using. // set the texture of the material Gpbuff.Mat.Type = CL3D.Material.EMT_LIGHTMAP; Gpbuff.Mat.Tex1 = engine.getTextureManager().getTexture("sometexture.jpg", true); Gpbuff.Mat.Tex2 = engine.getTextureManager().getTexture("sometexturelightmap.png", true); Can you please help me? Thanks. |
||||
|
Hm, does it find the file at all? Maybe you've mistyped the url or some letter? |
||||
|
No i didn't because when i am setting the lightmap as texture to tex1 it's loading it ok.Is it possible that this mabe a bug? |
||||
|
Hm, could be. One possibility is that your texture maybe is no power-of-two texture. If it isn't, try scaling it to something like 128x128, to see if it works then. |
||||
|
It's not working.Maybe you must check it out if there is a bug Thanks |
||||
|
I tried it out, and found the material is working, but I think I found what your problem might be: You need to set a second texture coordinate for the lightmap. When you are using the Vertex3D structure to describe your 3d model, use the TCoords2 member of it to set a texture coordinate for the light map as well. |
||||
|
I did it and i can see the lightmap but the coordinates of texture 2 must be wrong (i used the same as tex1).Can you please tell me how can i get the right texture coordinates for the lightmap? Thanks. |
||||
|
I'm also using the same coordinates, like here:
works perfectly for me. Maybe your lightmap texture simply is too dark? |
||||
|
I will make some experiments with 3d studio max. Another thing i wanted to ask you is how can i make a texture tiled? For example if i have a face 100x100 and i want a tile 10x10 to give as texture the tile and the tile will be repeared 10 times in width and 10 times in depth? Thanks. |
||||
|
Simply set the texture coordinate so that the texture gets repeated that often. If you have a quad starting with the texture coordinate (0,0) in the left upper corner and with (1,1) in the lower right corner, the texture will be repeated exactly once. Make it (2,2), it will be repeated twice. And so on. |
||||
|
I just had the same problem. using test.jpg as diffuse and actionsign.jpg as lightmap. (from the tutorial example 3) diffuse tex1 appeared to be completely black, and under the text and arrow of tex2 no blending was visible. I then increased brightness of tex2 by 50%, et voila! Works now, tho it seems the range that can be used is 128 to 255, due to seemingly tex2 being blended using "/2 multiply" (or something), and not just "add" as I would have expected. So the lightmap can darken or brighten the tex1 texels, depending on whether lower or higher than 127,127,127. Hey Niko how about to release the b3D loader as an open source extension to Copperlicht - if we don't have to reinvent the wheel, this may get a Greta von Thunberg certificate ^^ |
||||
|
Hie, @CSP-Games, Dieter, hope you are doing good. Glad to have you back to the forums :) Happy New Year :)) ![]() |
||||
|
Hey Howdy ^^ Happy New Year to you too! Excuse the delay, I'm on a submarine mission in a sea of Api documentations. |
|