can you remove a texture from an entity?

Blitz3D Forums/Blitz3D Programming/can you remove a texture from an entity?

DrakeX(Posted 2004) [#1]
for some reason, i've never come across this before today, and now i'm kind of stuck. it's very easy to texture an entity, but is there any way to take the texture back off again?

i'm making a quick little editor for texturing objects with multiple layers of textures, and i'd like to be able to remove textures as well as add them. but i just can't seem to figure out how i'd go about doing that.

EntityTexture <e>,0 just gives an error, and there is no way that i can see that i could use brushes to remove the texture.

what a conundrum!


Strider Centaur(Posted 2004) [#2]
Umm just make a default texture? You know a white texture and then retexture with that.

For that mater make a default brush so you know all properties of a mesh are returned to normal( your choice of what normal is).

Well its an idea?


sswift(Posted 2004) [#3]
No, there is no way to remove a texture. I have struggled with that for a long time with my shadow system, because I need top copy the entity and make it black so I can render it for a shadow. But if the entity has an add blend texture on it, then simply changing the entitycolor to black won't cause it to render as black.

Here is a suggestion though. Make a copy of your entity before you've applied any textures to it and apply the textures to THAT. Then when you need to remove a texture you can delete that copy and make a new copy and reapply the remaining textures.

That's the only way for you to do what you want that I can think of. Unfortunately it is of no help to me with my shadow ssytem as I don't get access to the entities until after people have mucked with them.

Oh and in case you're wondering, a brush without a texture will not remove textures from an entity.


DrakeX(Posted 2004) [#4]
SOB. well then.

i'll just have to make it so you can't remove textures, i suppose.


BlackD(Posted 2004) [#5]
There are lots of workarounds drake. For instance - if you get really stuck, copy all the vertex points and triangles in a mesh - recreate them as a new mesh, and retexture it, deleting the old mesh.


WolRon(Posted 2004) [#6]
Unfortunately it is of no help to me with my shadow ssytem as I don't get access to the entities until after people have mucked with them.
I haven't seen your shadow system, but couldn't you create a (pre)function that allows the user (if they choose to) to pass you the entity before they've applied a texture to it?


jfk EO-11110(Posted 2004) [#7]
Bah - heathen ;P . How about to create a brush from the color white. Then use the Command "Paintsurface" with this Brush on all Surfaces of the mesh. If you used to load it with LoadAnimMesh then you may need to parse the mesh recursively for children (as described here: http://www.blitzbasic.com/codearcs/codearcs.php?code=1170 )


Storm8191(Posted 2004) [#8]
Why not just create a white texture, say, 32x32, and when you want to take the texture off, apply your white texture? It might not really be a no-texture mesh, but it'll still look like one.


jfk EO-11110(Posted 2004) [#9]
yes, I did that too, it's a workaround (and maybe the easiest). Nevertheless the proper solution would be to use a white Brush since a Mesh without any texture is using such a brush by default.


sswift(Posted 2004) [#10]
"I haven't seen your shadow system, but couldn't you create a (pre)function that allows the user (if they choose to) to pass you the entity before they've applied a texture to it?"

No, because many users just load B3D files which have the textures already applied at load time.


Strider Centaur(Posted 2004) [#11]
You know, from a visual and programatic stand point, I cant see any advantage between using a PaintSurface( Wouldn't PaintEntity be better to avoid recursive paintings?) and using a default plane white 256x256 texture( other than a little bit of memory used to store the texture). Personly I would go the texture route because it stands a good change of making things much easier down the road by treating the mesh the same textured or not( that is textured with a user defined one or default). This also allows for the easy substitution of what the default texture is, so for instance a checker pattern could be applied to entire sceen of defaults simply by changing the default texture, no need to repaint every entity that is set to default.

I would still use brushes to paint the default texture to a entity, for reasons I mentioned last post( being able to insure all entityFX, shininess and what not, were set to default as well)

But I imagine there is no one right solution to this, just use what works for you.


Strider Centaur(Posted 2004) [#12]
Oh, Sswift, why not make your shadow load the shadow texture as a alpha shaded shadow mask overtop of there existing texture, we have 7 layers per surface right? Granted it would have to be the top layer and some models may already have 7 layes, but I bet that would be the oddity.


sswift(Posted 2004) [#13]
Strider:
I considered that, but if I put a black texture on layer 7, then if the video card being used doesn't support 8 hardware layers (and many don't) then it would potentially slow the system down because the number of polygons in the character could be doubled or quadrupled by Blitz to render it the fake way.

(As far as I know there is a max of 8 layers pur surface.)


Strider Centaur(Posted 2004) [#14]
I see, but couldn't you stick it on layer 3( the forth layer) witch most present cards do support and is still high enough to be out of the way of most models testures? One aproach I was thinking is let the programmer have a way of specififying what layer to put it on. That way its up to the user of the library to handle the config. Im betting most people never use more than 2 layers at any one time.

BTW, your tools are awesome, though I have yet to purchase anything, I have seen them in operation. :)


DrakeX(Posted 2004) [#15]
i suppose i could do that - retexture with a white texture with a blend mode of multiply (or a black texture and blendmode of add). but since it's actually a terrain, i was able to just reload the whole thing.

it still really makes me mad to think that i could make it work if i knew where the texture handle for the brush was stored, and then just manually set it to 0 and call freetexture (to lower the refcount). ah, the joys of having your own engine where you can make it do anything you want.


jfk EO-11110(Posted 2004) [#16]
Using the Commands surfaceBrush, BrushTexture and TextureName$ will allow you to do that too.


Zenith(Posted 2004) [#17]
does EntityTexture entity,0 not work? I thought it did.


jfk EO-11110(Posted 2004) [#18]
Well DrakeX said it gives him an error. No surprise since the texture handle 0 does not exist - althouh it may be a reasonable feature request, as seen in premoving parent relations with ParentEntity e,0


DrakeX(Posted 2004) [#19]
exactly. we think alike ;)