Applying an image to a sprite.
Blitz3D Forums/Blitz3D Beginners Area/Applying an image to a sprite.
| ||
I want to apply blood, cuts, etc to my character as he gets hurt, I am able to apply just flat color but am so far unable to use images of blood splatter and such, anyone able to help. |
| ||
How are you applying the flat colours? Is this a 2D or 3D question? |
| ||
3D. |
| ||
Sprites aren't really the best way to do cuts and blood on characters. They work well for bulletholes on walls, footprints on the ground, etc. but for stuff on characters you usually want to alter the texture of the model, possibly altering/swapping the main texture or possibly using masked textures on a new texture layer. That said, applying an image to a sprite is just like applying a texture to any other entity. Seriously, use the command EntityTexture to apply the images to your sprites. |
| ||
I messed up with the title of this thread. I want to add blood,cuts,burn effects to characters as well as background objects, I've been looking at the texture paint example by David Bird that came with blitz and rather then just painting with a solid color like red(when it goes over skin colors it gets a little to neon) I'd like to use an image if possible, any idea how this can be doen. |
| ||
I think because you can't access the texture on an entity you'll need to keep a copy of the texture(s) image for each entity then when applying you simply set the buffer to the texture buffer drawimage at the right place/orientation and then reapply the texture. However someone else might know a better way. |
| ||
I think it is possible to multitexture, at least it is with lightmaps, I'm not shure what commands to use. |
| ||
(when it goes over skin colors it gets a little to neon) Use a different blend mode. To draw from one texture to another, take a look at the CopyRect function. |
| ||
at the right place/orientation And how would you find that exactly btw? |
| ||
When I use a different texture blend the texture just becomes invisble |
| ||
"And how would you find that exactly btw?" I'm not sure what he meant by orientation, but for place you'd use the VertexU and VertexV commands on the vertices of the polygon collided against to determine the UV coordinates of that polygon. Then DrawImage to the pixel coordinates corresdponding to those UV coordinates. That's all a real pain however, and probably wouldn't work well due to seams in the texture mapping. But who knows; that's certainly the most accurate way to do things. Maybe Terabit (aka Mr. Tattoo) has some advice here. |