multilayering textures
BlitzMax Forums/MiniB3D Module/multilayering textures
| ||
Is layering of textures supported in miniB3D? I assumed so since the BrushTexture command has an index parameter, but I can't get it to work. ADDITION: It just dawned on me that perhaps the problem is my videocard. I'm working on an older laptop right now; I'll test it on a better machine tomorrow. |
| ||
It should be, yes. |
| ||
hm, perhaps it works on Windows but not on Mac? I'm working on a Mac. From a number of clues, it's looking like it simply ignores the index parameter and always loads the texture as the base layer. For example, no matter what layer it is loaded on, the last texture added is always the only texture visible. Also, when I set the blend mode to Add, the effect is that of the single add-blend texture and nothing else (ie. it's adding to the mesh color.) |
| ||
Does your card support multistage texturing at all? (As you are on a mac: does it have a FX5200 at least) |
| ||
I'm not sure about this laptop; as I said it's relatively old so I suspected that could be the issue. However, when I tested on a MacPro (ie. the most burly model of the new Intel-based Macs) it still didn't work. |
| ||
Alright, I theorized that maybe there was a bug with using multiple layers on brushes, so I did a simple test using just EntityTexture:Import sidesign.minib3d Strict Graphics3D 640,480 Local camera:TCamera=CreateCamera() MoveEntity camera,0,0,-3 AmbientLight 255,255,255 Local cube:TMesh=CreateCube() Local tex1:TTexture=LoadTexture("media/test.png") Local tex2:TTexture=LoadTexture("media/sand.bmp") TextureBlend tex2,2 EntityTexture cube,tex1,0 EntityTexture cube,tex2,1 While Not KeyDown(KEY_ESCAPE) If AppTerminate() End RenderWorld Flip Wend Unless I made a mistake with the code somewhere (did I make a mistake in the code?) this should have the sand texture multiply blended over the image. However, all I see is the sand texture with no blending. Does this code work on Windows? This is using the media from the examples that come with miniB3D. To run the code, just save it to the 'examples' directory. Oh, and EntityBlend works, so blending of the entire model works, it's just that layering textures isn't working. I may end up faking multitexturing with multiple copies of the mesh. |
| ||
The plot thickens. I just tried loading a gile[s] lightmapped level to test, and that worked. So clearly multitexturing does work (since the lightmap is a multiply-blended layer over the main texture) if I load a b3d file with the multitexturing already setup. Either I am doing something wrong in my code (please double check what I posted) or there is a bug in setting up multitexturing with new textures. |
| ||
Your EntityTexture lines should read:EntityTexture cube,tex1,0,0 EntityTexture cube,tex2,0,1 EntityTexture(ent:TEntity,tex:TTexture,frame=0,index=0) |
| ||
Good spot if this were Blitz3D, but there is no frame parameter in miniB3D. Doing two numbers like that throws up an error "too many parameters" Although, did you copy that line from new documentation or something? Is there a newer version of miniB3D and the sticky here is still pointing to an older version? |
| ||
MiniB3d 0.41 sidesign.minib3d : Function EntityTexture(ent:TEntity,tex:TTexture,frame=0,index=0) I do have Klepto's module installed too, but the above quote is from Simon's module docs. EDIT: My OS is Windows XP, if that makes a difference? EDIT2: I just downloaded the latest version in the sticky thread and checked Simon's code. The docs do indeed match the function declaration. Function EntityTexture(ent:TEntity,tex:TTexture,frame=0,index=0) TMesh(ent).EntityTexture(tex:TTexture,frame,index) End Function |
| ||
aha, you're right about EntityTexture, because now that works! It's BrushTexture, the command I mentioned in my first post, that doesn't accept the same parameters as Blitz3D. Alright, so for this specific task I could split up my model into pieces and use EntityTexture, but I'm still wondering why BrushTexture isn't working right. ADDITION: Alright, I finally went and looked at the module's code, and I see that while the BrushTexture method has both the frame and index parameter, the BrushTexture function only has index. So I'll just try fixing the function and then rebuilding the module. ADDITION2: yay, it works. Okay so simon the bug with BrushTexture is simply that you need to add the frame frame parameter into the function. |
| ||
Aha, good find. |