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.

Work in Progress / [DBP] Material System for Level Geometry

Author
Message
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 11th Jun 2009 06:13 Edited at: 24th Jun 2009 05:48
I managed to package up a demo of my material system thus far, however, many features are still unavailable. The shaders in the example are made by Evolved, and as such credit is owed to him. The demo level is constructed in Map-Scape(also by Evolved) and exported out as a DirectX 'x' file.

The function automatically initiates a shader based on the media available.

For example: You texture an object in Map-Scape with a texture named "texture01.png", the function then searches for the files "texture01_dot3.png" and "texture01_height.png." If both are found, the function replaces the texture with a parallax shader. If only a "_dot3" file is found, only a normal mapping shader is used. And finally, if neither are found only a per pixel lighting shader is used.

There are still things that are kinda hardcoded in the 'library' but i figured I'd release it to let others play with. Hopefully I will have the time to continue working on this as I think it makes it easier to create maps that dont rely on code.

I would also like to restate that the shaders are not mine. They were programmed by Evolved. I have only created the simple system to automatically load them. Hope it helps someone out... i eventually plan on adding in an automatic shadow system eventually.




Edit:
Newest Version

Attachments

Login to view attachments
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 11th Jun 2009 17:56
Wow, I never thought that you could do this. I was actually thinking of making my own file format which will take ages to make. Thanks so much for posting this!

And why is this being allowed to fall? I think its the most useful code snippet we've had for a long time.

Looking forward to more progress!

New specs: Nvidia Geforce 9600GS 768MB, AMD Anthlon x64 X2 4000+ (2.6GHz Dual core), 3GB DDR2 800MHz RAM and a big hard drive.
Phosphoer
16
Years of Service
User Offline
Joined: 8th Dec 2007
Location: Seattle
Posted: 11th Jun 2009 21:33
If I was making a 3d game I'd be all over this :p, nice work!

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 12th Jun 2009 00:47
Very cool! I've always wanted a proper material system for DBP. Something that would make it easy to apply normal and specular maps and what not. I'm looking forward to seeing how this progresses.

i like orange
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 12th Jun 2009 02:53
Thanks very much for the replys! Actually I thought of the idea a while back, but just finally got around to it... to tell the truth i didnt think it would work, since i havent seen anyone else using this method. Gave it a shot though and was pretty happy with the results. I came to the conclusion that either noone has used this method or they just kept it a secret, lol.

I'd still like to think of a fairly efficient shadow system as well as some multiple lights, not too mention take the light setting(s) out of the include file, lol.

i'd really like to switch the lighting system to use deffered shading... ive always had troubles implementing it though. Maybe if i get some extra time from work i'll actually read through it and see what my problem with it is.

Anyways thanks again for the compliments, and as I see there is an interest, i'll have to devote more time on it

If anyone makes anything cool with it, I'd love to see your screenies
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 13th Jun 2009 02:03
I'm working on a little room right now, I'll be sure to post my results when I'm done.

i like orange
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 13th Jun 2009 02:19
Cool, I look forward to seeing it If time permits... I'm gonna toss together a nicer level too... that one only took about 5 minutes lol.

I thought of a new test im gonna try with it too... I dont know if it will work tho...Advanced terrain... but that will be for another day. Its been a long day already.
Xeridox
21
Years of Service
User Offline
Joined: 19th May 2003
Playing: Scrap Mechanic
Posted: 15th Jun 2009 03:47
Interesting, I just wrote something similar for my game, Phenom...
The only problem I'm having is getting multiple lights in the shader...and keeping it working with lightmapping (DarkLights).

I'm using Evolved's shaders too, with some trial-n-error modification.

Phenom - MP FPS WIP - With bot support, even online!
Official Thread -> http://forum.thegamecreators.com/?m=forum_view&t=149585&b=8
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 24th Jun 2009 04:00
Thank you, this is awesome.
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 24th Jun 2009 05:45 Edited at: 24th Jun 2009 06:01
Thank you for the comments. While work hasn't allowed me to play on the computer too much lately, I have made enough time to toss together an updated version that exposes a few useful settings embedded inside the shaders themselves.

The functions/variables in the library are as follows:

Variables to retrieve light info:

mLightPositionX#
mLightPositionY#
mLightPositionZ#
mRange#
mAmbientR#
mAmbientG#
mAmbientB#


Functions:

initMatSys( startImage )

Initialize the material system. startImage should be an image number after all other used images in your program.

mLightRange( range# )

set the shaders light range.

mAmbient( r#, g#, b#)

set the shaders ambient light color

mPositionLight( x#, y#, z# )

position light for shader

mProcessObject( objnum )

automatically set shaders to a MapScape '.x' file based on available media (ie, texture.png = per pixel lighting, texture.png + texture_dot3.png = normal mapping, texture.png + texture_dot3.png + texture_height.png = parallax mapping)



I also set the lighting system to automatically setup shadow light 0 so you can use dynamic shadows easily.

I still havent figured out a decent way to utilize multiple lights/shadows yet. I think I may begin doing a rewrite utilizing deferred shading which is more suiting for multiple lights.

The shadows require a bit of tinkering to look right, but if your project only requires one light, I'd say this is in a fairly useable state.

The original scene, now with shadows:

Attachments

Login to view attachments
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 24th Jun 2009 12:36
Excellent!!

New specs: Nvidia Geforce 9600GS 768MB, AMD Anthlon x64 X2 4000+ (2.6GHz Dual core), 3GB DDR2 800MHz RAM and a big hard drive.
draknir_
18
Years of Service
User Offline
Joined: 19th Oct 2006
Location: Netherlands
Posted: 24th Jun 2009 12:59
Looks great! Deferred light rendering in DBPro would be really amazing, let us know how that goes.
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 24th Jun 2009 14:46 Edited at: 24th Jun 2009 14:51
I do have one idea as to how to utilize multiple lights and shadows without deferred shading, but I think it would be slow and I don't really know how to do it...

The idea would be render the scene to an image once for each light. after its done, combine the images and display to screen. I'm thinking that would be overkill tho.

Anyhow, thanks for the messages, and if you think of something else you'd like in the library, lemme know. I can't make promises, but I'll give it a hellavu shot

Edit:

btw, deferred shading has already been done by Evolved(http://evolveduk.googlepages.com/Index.html)

For the most part, when I figure out how to use it properly( i always get black textures in my own implementations ), it will be pretty much plug and play-- well aside from changing my lighting and shadow functions.
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 25th Jun 2009 02:16
Here is another test level I threw together. The source code makes the light rotate around the level changing the shadow dynamically.

this still isn't a 'proper' level, but i felt like putting one together that had a bit more detail...

It unfortunately does show the stencil shadows artifacts more, but i'll let the coder use there own workarounds for that

Attachments

Login to view attachments
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 25th Jun 2009 02:17 Edited at: 25th Jun 2009 02:18
And a pic of the new level...

Attachments

Login to view attachments
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 25th Jun 2009 05:01 Edited at: 25th Jun 2009 05:03
I've been trying to get this to work with Blender but apparently Blender doesn't correctly generate limbs on export, so it's not going too well. If I get it working I'll be sure to post about it here though and put up screenshots.

i like orange
Coldfire
16
Years of Service
User Offline
Joined: 22nd Oct 2008
Location: Indiana
Posted: 25th Jun 2009 06:11 Edited at: 25th Jun 2009 06:11
Actually to tell the truth, I have had troubles with pretty much any x file besides ones exported from mapscape...

I think possibly it is the naming of the material inside of the x file. If I'm not mistaken, I think some of them have the extension of the texture removed, but not too sure... if you can upload a copy of your work so far, I'll take a look at it and see how the x files differ. Maybe I can figure it out that way. I'm also curious if this works with 3DWS x files...

When I have time I'll take a deeper look into it. If anyone else figures out a solution, I'd be more than happy to hear it

Login to post a reply

Server time is: 2024-11-24 09:22:53
Your offset time is: 2024-11-24 09:22:53