Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / What is a regular routine to paint something on textured object? (2nd texture?) bullet holes, declas etc..

Author
Message
mhack2
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 21st Dec 2004 04:02
Hi All,

Is there a way, other than using textured plain objects, to paint something (texture) on already textured object.
Like if I have a wall already with bricks texture, and want to add some cement spots in some places, or a picture, or a bullet hole?

Is there a second texture option?

How do you guys do it usually?

Thanks.

[url=akdusa.com]akdusa.com[/url]
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Dec 2004 05:31
I've never tried it - but I do know that Kevil posted an example a while back - try the code snippets forum or the code base, he uses the intersect object command, but perhaps it could be changed for that free collision .dll.


Van-B


It's c**p being the only coder in the village.
mhack2
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 21st Dec 2004 05:37
I know how to find intersection point, I'd like to find out what options we have to actually put decal there..

Thanks

[url=akdusa.com]akdusa.com[/url]
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 21st Dec 2004 05:41
Ahh right, sorry - I'd suggest using small plains with decal textures, then positioning them at the intersect point and aligning them. Using a set number and cycling through them is a good idea.


Van-B


It's c**p being the only coder in the village.
Clueless
21
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 21st Dec 2004 05:58
Ah, Van B, you're so good you don't even realize all the things you know . I think you gave me a possible answer to his question in response to something I asked last week:

Quote: "Is there a way, other than using textured plain objects, to paint something (texture) on already textured object.
Like if I have a wall already with bricks texture, and want to add some cement spots in some places, or a picture, or a bullet hole?"


How about texture blending as a solution? I was trying to blend nighttime city lights and/or lightening strikes onto the dark side of a planet after reading the posts in the Blending thread currently running in this forum.

I was using one of the planets I made available for free upload. It's just a sphere with a single texture map. With a second texture file, all white except for what what in mhack's example would be the bullet hole textures but in my example were points of light.

Anyway, when the original texture was blended with the second "city lights" texture, it looked like bullet holes appearing on my planet. Why? Because it was on the nighttime side of the planet (doh!) and my planet object was set to be sensitive to the lighting in the scene.

So, by mistake I ended up with a very convincing bullet hole effect. I'm presently reworking it to be the scars of a nuclear explosion and nobody will ever know it started out as a mistake.

Uhm. Well, OK, so now they know.

mhack2, try the "asteroid" example in the DBPro help and tutorials (search for help on Blending and it'll lead you there). I'm not promising it'll be all you want, but then again, maybe it will.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 21st Dec 2004 17:14
mhack2,
I've never done it before, but what you're after is;
* First, find the point of intersection ( intersect object, or however you like )
* Next, Determin the triangle of the model it has hit,
* Get the UV coordinates for that triangle, and compare their 'sizes', so if the UV map of the object was squshed up vertically, then it'd have half the size of the actual triangle height-wise
* Rotate/Scale the bullethole/blood splatter etc to fit the UV map ( using the values obtained in the preivous point )
* Finally, paste the image onto the same image your using for the texture, then update the object's texture.

I'm not too sure on how to do some of those parts, but they're the basics steps I would take to do it

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
mhack2
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 21st Dec 2004 21:34
Thank you guys.

Actually, what I need is even easier than blood.
I have a very big wall textured with the same image.
What I need is at some parts of the wall to add some detail image.
It's not even dynamic, it is set in the beginning.

Blending sounds like a good function to start with..

[url=akdusa.com]akdusa.com[/url]
Clueless
21
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 22nd Dec 2004 06:31 Edited at: 22nd Dec 2004 06:32
mhack2:

I can post some code and screenie tonight when I get home if you'd like, but I bet you've got it solved by then if the blending works for you as it did for me.

What I did, adjusted for your own demo:
1. Load my original wall model with texture

2. Load a second image with the same dimensions as the wall texture image. This second image is completely white, except where I want my bullet holes

3. Did a quickie preview program where I went into a FOR/NEXT loop using the loop index as the blending mode argument, blended the second image with the first, output the blending mode (loop index variable) to the screen and wait on a mouse click to move on to the next blending mode. Eventually I found a look I liked, where white was treated as transparent and my "bullet hole" texture blended seamlessly into my "wall".

I also saw a lot of other neat effects from different blend modes, that I hope to go back and play with later.

(If you do the preview thing, you'll want to reset your object's texture before applying each blending mode. I did what they did in the DB example -- loaded the wall texture as an image and then TEXTURE OBJECT between each test, so that I wasn't blending over the results of the previous tests.)

Hope that makes sense.
mhack2
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 22nd Dec 2004 22:56
Thank you,
this is interesting, but how about if wall is tiled with texture and I need bullet holes just in one place, not all over the wall?

Was busy working on my game, didn't look in to this yet..

p.s. It takes so much effort to create even smallest FINISHED game

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Dec 2004 23:05
If you had a long wall and only wanted, say a big poster on it, you could'nt use the same mesh to put the poster on - really you would have to make a seperate plain for the poster. That's one of the drawbacks with DBPro right now, the lack of multitexturing support, once we get that we'll be able to mix and match textures with much more control - without being able to modify UV coords for each texture layer, there's only so much that we can do with blending textures. They're great for when you have no tiling, like Clueless's planets for instance, but on long walls things get complicated.


Van-B


It's c**p being the only coder in the village.
Clueless
21
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 23rd Dec 2004 06:46 Edited at: 23rd Dec 2004 06:55
Hi mhack2:

Quote: "this is interesting, but how about if wall is tiled with texture and I need bullet holes just in one place, not all over the wall?"


I think you can control it using the placement of the holes in the texture you're blending into the wall, along with adjusting the UV data (scaling the wall texture). I did a quick example if you want to have a look:

http://www.alsip.net/gamedev/wip/walltest.zip

I've read a lot of posts about lack of multitexturing support as Van B wrote, but I didn't understand what it meant until I worked through an example, which means I didn't realize how badly I wanted that feature also.

So there's some trickery in what I did here, but it was just a few seconds work in Photoshop to pull it off. There are four images with bullet holes, showing a cumulative effect. The image files are extremely small jpg's so I can't see them causing any trouble as far as performance of the graphics card or the game.

Even if this wasn't what you were after, I sure learned a lot working through it! Here's the finished effect:

One: an innocent wall, minding it's own business:


Two: first shot is fired:


Three: after four shots (somebody really hates this wall):
mhack2
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 23rd Dec 2004 22:36 Edited at: 23rd Dec 2004 22:38
This is very good, thank you for your effort!
I'll try what you are suggesting.

BTW, do you guys think that we can access DLL to call multitexturing Direct X commands directly?

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd Dec 2004 23:29
mhack2,
If only we could acess the object's data from DBPro... That would allow us to do just that.

But, unfortunatly, we cannot.

I wish you well in your bullet code

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
mhack2
21
Years of Service
User Offline
Joined: 10th Oct 2003
Location: USA, Earth, Sol[0,0]
Posted: 24th Dec 2004 01:45
@JessTicular: Thank you!
I'm actualy more interested in adding detail to long walls

Anyway, you guys provide so much information, it seems every time DB shows us another of it's "front page advertised" features that don't work, our collective mind here finds a workaround

Clueless
21
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 24th Dec 2004 05:05
Quote: "I'm actualy more interested in adding detail to long walls"


Something I've been trying to learn also. Seems like the really good games have a way of adding just enough "something" to what you know is a repeating texture to break it up and make it look... well... like it's not a repeating texture.

JessTicular, I'm wondering if there is a particular class or structure that we'd need to be able to access as you mentioned?
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 24th Dec 2004 13:34
mh,
Yeah, when people put their minds to it, anything can be accomplished.
And, as it's said, Two ( or even fifty ) heads are better than one!

Clueless,
I'd say they use either a single, High-res texture, or multiple, Low-res textures and tile the textures across/down the 'wall' using multiple UV coordinates.
Or, infact, I would say that the walls are simply broken into more peices as almost every commercial game doesn't suffer from the speed issues that DBP does ( not saying that it's *THAT* bad, but it is slower ).

About accessing the object data... Yeah, something like that.
However the data is stored internally, we just need a pointer to the array holding all the data, and we're set, 'cos from there, we can access it all
However, if you have read the newsletter now, you will see that for 5.8 ( hopefully soon ) there is a full set of Object Data controll and access

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Clueless
21
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 24th Dec 2004 14:43
@Jessticular:

Quote: "Or, infact, I would say that the walls are simply broken into more peices as almost every commercial game doesn't suffer from the speed issues that DBP does ( not saying that it's *THAT* bad, but it is slower )."


Yes, I agree with you about the speed thing. I love my DBPro and it is very capable for what I use it for, so no major complaints from me. But I'm always happy to see improvements.


Quote: "However the data is stored internally, we just need a pointer to the array holding all the data"

Seems like there should be a pointer there somewhere for us to grab. I suspect there are already some good plugins doing that. I've been slowly digesting a DirectX programming book and it looks very much like there are a lot of things we could do if we could just decipher it all. Also, it makes me appreciate DB more knowing all they had to do to hide those nasty details from us.


Quote: "However, if you have read the newsletter now, you will see that for 5.8 ( hopefully soon ) there is a full set of Object Data controll and access "


Doh! I didn't catch on that the latest newsletter is out. Time to go read...

Login to post a reply

Server time is: 2025-06-03 18:01:27
Your offset time is: 2025-06-03 18:01:27