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 / Saving shader effects to a model?

Author
Message
Mugen Wizardry
User Banned
Posted: 28th Aug 2011 02:29
Hi all. How would I save shader effects to a model? I have a feeling this may be the only way to save the detail I need to my terrains

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
Bluespark
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 28th Aug 2011 02:43
Shaders effects are saved in fx files.
For the detail map, you will need to convert object fvf and set the appropiate uv coordinates. The simplest way to have a tiled detailmap afterwards is to scale the texture stage for the detail map and use blend mapping.
Mugen Wizardry
User Banned
Posted: 28th Aug 2011 02:44 Edited at: 28th Aug 2011 02:46
Ok, could you possibly show me a small example of how to do this as well as being able to save the object WITH the detail?

I would be GREATFUL

Thanks alot!

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
Bluespark
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 28th Aug 2011 02:46
A good example from the user Jane Doe:



The two textures are blended.
Mugen Wizardry
User Banned
Posted: 28th Aug 2011 02:51
does this allow for saving? thats what im really after. saving the detail to the model.

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 28th Aug 2011 04:15 Edited at: 28th Aug 2011 04:16
Quote: "does this allow for saving? thats what im really after. saving the detail to the model."

you cannot save a shader to a model, you save it as a .fx file then apply it to the model at runtime

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2011 15:23
Mugen you really won't be able to save two seperate texture levels no matter how they are blended in your program as ".X" files only have one texture level as I explained in the other thread...

I would look at different model types (IE. "3DS") and see if they allow more than one texture level to be saved. Then (if they do) you may need to look into learning how to write this information out. I still stand by my previous advice for the best way to approach this problem.

As SH4773R suggested shaders are 'run-time' effects only that will not be saved to the model. Graphical effects like this are calculated and displayed by the graphics card and have nothing to do with the model itself.

Mugen Wizardry
User Banned
Posted: 28th Aug 2011 16:37
I've seen X files with more than 1 texture -.-

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
Mugen Wizardry
User Banned
Posted: 28th Aug 2011 16:44
Once again, I prove u wrong.



CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Aug 2011 16:50
DBPro can load .x files with multiple textures (as per Truespace 7.6), but can't save them - If you want multiple textures, then you use .dbo files. Doing it this way would also save out most (if not all) of the other settings you make to your terrain, excluding any effects you apply using shaders.

Mugen Wizardry
User Banned
Posted: 28th Aug 2011 16:55
ok. thats a start. now, what program can i use to translate the DBO file into a multi-textured X file or 3DS file? Right now, I'll use ANYTHING

Thanks, Ian

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2011 20:04
Quote: "Once again, I prove u wrong."

I'm sorry, are those textures being applied to the same part of the mesh on different texture stages or to different parts of the mesh/model?

I didn't say you couldn't save multiple textures just not multiple texture "levels"...

If you have proven me wrong on that then I have just learned something. Hard to tell looking at that code you posted as I don't understand ".X" file code, I'm just going on what I read on the Microsoft website in an effort to help you.

Any chance you could try being nice to me after all this time instead of using phrases that sound like "In your face!"?

IanM, it might help save some time if you understand that what Mugen is trying to achieve is a saved terrain with the texture and detail map pre-'blended'. In other words with multiple texture layers already 'preset' into the model so it will load fully textured and detail mapped. Correct me if I'm wrong MW?

I didn't think that was possible but I'll be happy to be proved wrong as it will help Mugen achieve his goal

Mugen Wizardry
User Banned
Posted: 28th Aug 2011 20:30
You're correct. I'm sorry.

Now that that's out of the way. Is there ANY way to use Jane Doe's code, to SAVE multiple layered textures to a model?

Right now, I'm willing to try anything

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Aug 2011 22:04
With that explanation of what is wanted, no.

While the .x format can be expanded to contain almost any detail you want, the program you are loading it with must be able understand the data you provide, or it will ignore it.

The problem is that the format of .x exported by the majority of exporters contain only a single texture layer per mesh, and even when they do export multiple textures per mesh, they don't specify texture blending information.

Basically, if you want to save any information other than mesh or texture data, you must do it yourself (because DBPro doesn't do this for you), and the program receiving it must understand the new data being passed to it.

That all said, how about looking at it from a different direction - rather than save your mesh with all the different textures, why not create a single pre-blended texture and use that instead.

- Create a plain with the same number of texture levels as your terrain.
- Texture the plain with the appropriate textures and blend them together.
- Render that plain to another image.
- Apply the image to your mesh.
- Save your mesh.

Mugen Wizardry
User Banned
Posted: 28th Aug 2011 22:13
how do you render a plain to an image?

if i saw how to do it, i may be able to manipulate that, and get what i need

Thanks, Ian!

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2011 22:47
Or you could do what I already suggested in the other thread and create a 'super-texture' in a paint program such as GIMP which contains the terrain texture and the 'detail' map combined (then apply that to the terrain, then save the mesh... you would achieve the same end effect as IanM's suggestion).

You might be less limited for the maximum size of your new texture that way, my own PC has a maximum render size of 4096x4096 pixels I think. Your super-texture could be twice that (or more I guess) if you wanted.

Mugen Wizardry
User Banned
Posted: 28th Aug 2011 23:27
how would i do this in my copy of photoshop cs4?

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Aug 2011 23:36
Not used cs4 but you'll need to use transparent layers.

1-Open the texture image
2-Add new layer
3-Paste detail map into new layer
4-Set transparency of detail map (and/or erase areas out)
5-Save new image

...something like that.

Mugen Wizardry
User Banned
Posted: 28th Aug 2011 23:40
thanks!

CHECK OUT MY WEBSITE AT http://imageposeidon.com/ !

Login to post a reply

Server time is: 2026-07-10 10:20:16
Your offset time is: 2026-07-10 10:20:16