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.

FPSC Classic Models and Media / Custom shader - Phong-shaded with normal map (with spec maps in dev)

Author
Message
Roger Wilco
18
Years of Service
User Offline
Joined: 6th Jul 2005
Location: In the Shadow of Chernobyl
Posted: 29th Dec 2008 23:20 Edited at: 29th Dec 2008 23:21
Hey everyone! I thought that since a lot of people seems to have grasped the workings of shader effects, I'd release my modified shader as well, which I've tinkered with on and off for some time. It's from nVidia's FX Composer library (originally called phong/bump/relfect or something alike) but heavily modified, and I've been granted permission from a guy over at nVidia to release it to you guys. I was even encouraged to do so.

It works sort of like the bumpcubereflectalpha-shader from the FPSC library, but even better, if I may say so myself. It uses phong-shading and has specular reflection, although the specular reflecivity (strength of the relection) is currently a fixed value (can be changed through some haxxoring with the shader file ), I'm working on implementing support for using specular maps, so far it only works with character entities.

The specularity reflects in the direction of the light, like the previously mentioned FPSC shader, and the color of the light is also reflected correctly with this shader. Keep in mind though that FPSC does not support reflection of multiple lights natively. If your shaded object is in between two differently colored lights, FPSC will calculate an approximate 'mix' of the two light colors and pass to the shader.
Another thing that I'm working on is support for alpha maps for transparency, which currently doesn't work.

Everyone knows that pictures can speak louder than words, so here are some screens of it in action.

Aiko walking around in a very well-decorated room I made. Please note that the level of irony in that sentence was extremly high. xD

Here's a shaded Conker, complete with working specular map, as you might see from close inspection.

And here's a quick example of colored lights working. As you can see, the middle barrel reflects a slightly purple-ish light, since it's between red and blue.

The shader, or one of it's many variations I've made (this one works best though), is attached to this post. Just use the usual D/D2 and N suffixes, and things should work fine. S for specular maps for characters should work as well. Anyhow, enough talk, enjoy!

Attachments

Login to view attachments
Robert F
User Banned
Posted: 29th Dec 2008 23:32
Wow! This looks really cool!

Avid
16
Years of Service
User Offline
Joined: 24th Jun 2007
Location:
Posted: 30th Dec 2008 00:02
Amazing! Did you actually get a playable frame rate with all the detail in that room?

Joking aside, this is rather excellent. I would give this shader malarkey a go, except the composer needs service pack 2, and if I install that, my games break and I lose the internet. Time for a reformat I think.

BTW, do the normal maps work as well? Looking at the images they seem to, but I'd just like to check.

Visit my site http://www.fpsmodels.com for models and media for fps creator.
Robert F
User Banned
Posted: 30th Dec 2008 00:08
I was also wondering about the framerate.

Avid
16
Years of Service
User Offline
Joined: 24th Jun 2007
Location:
Posted: 30th Dec 2008 00:15
I'd imagine the shader has no effect on framerate. Simple shaders like these are calculated fine by any modern graphics card in its sleep.

Visit my site http://www.fpsmodels.com for models and media for fps creator.
Crav3
15
Years of Service
User Offline
Joined: 14th Oct 2008
Location: Down Under
Posted: 30th Dec 2008 00:45
Quote: "I'm working on implementing support for using specular maps, so far it only works with character entities."

OMG, As a 3D artist myself, this is like a dream come true. Because the lack of support fpsc has for a specular map this is really help full. It will create a open door for FPSC and It will make entities look a lot better.
Punk13
16
Years of Service
User Offline
Joined: 7th Oct 2007
Location: In EpikLand!
Posted: 30th Dec 2008 08:10
Man this looks way awesome good job man.

tjaabee
17
Years of Service
User Offline
Joined: 14th Apr 2007
Location: somewhere
Posted: 30th Dec 2008 09:55
Yay, RW is back! The shader looks yummy, Dl now...

Best.

Yor mod has been erased by a signature. (Oops... something is wrong)
Cyborg ART
17
Years of Service
User Offline
Joined: 14th Jan 2007
Location: Sweden - Sthlm
Posted: 30th Dec 2008 10:31
WoW!

Toasty Fresh
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: In my office, making poly-eating models.
Posted: 30th Dec 2008 11:41
Roger Wilco
18
Years of Service
User Offline
Joined: 6th Jul 2005
Location: In the Shadow of Chernobyl
Posted: 30th Dec 2008 12:03
Thanks for the feedback everyone, much appreciated!
I'll try to answer all questions the best I can.

@Avid: Yes, normal maps work perfectly.

@Robert: There's no noticable impact on framerate whatsoever as far as I can tell, since it's a fairly simple shader. But any reports on eventual performance differences is much appreciated!

@Crav3: Heh, yeah it's a dream come true for me as well. Hopefully, I'll get it working properly for normal entities soon.

@All: Thanks for the kind words! Be sure to show your appreciation to nVidia as well, since I used their library and app. Putting them (and me, if you want, for modifying the shader) in the credits is all I ask.

Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 30th Dec 2008 12:48 Edited at: 30th Dec 2008 12:53
This is an excellent looking shader, but it slows down my levels a lot. I put two characters in a room, and assigned this shader to them and I got 20-21 fps solidly.

My Specs:
Pentium D 2.80Ghz (D for dual-core)
1Gb RAM
ATi Radeon X1600pro
Windows XP SP2

Solutions?

AE

Aertic
16
Years of Service
User Offline
Joined: 2nd Jul 2007
Location: United Kingdom
Posted: 30th Dec 2008 17:27
Looking good, also any plans on parralax mapping?(As if we'll even see it in FPSC.)


"Your greatest teacher is your harshest critic"-'Butterfingers'
Demon Air 3D
15
Years of Service
User Offline
Joined: 16th Sep 2008
Location: England
Posted: 30th Dec 2008 17:40
its not working how do you get it work i think i did it wrong XD
and thanks alot for this it looks great[email]
creator of zombies
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: UK: West Wales
Posted: 30th Dec 2008 17:54
Looks good mate. It's similar to my relief mapping shader (Just it doesnt have the slimy look etc) But keep it up!

Quote: "any plans on parralax mapping?(As if we'll even see it in FPSC.)"

You will see it in FPSC because I have it working perfectly

CoZ



Avenging Eagle
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location: UK
Posted: 30th Dec 2008 18:15 Edited at: 30th Dec 2008 18:16
@DEMONAIR

In the effectsbank, create a folder called "phong_bump_specular", and then extract the shader into this new folder. When in FPSC, right click on your character and go down to the 'effect' box, and change it to the .fx file inside your phong_bump_specular folder ("phong_bump_specular.fx").

Also, remember to turn full shader effects on in preferences.
--------------------
I've worked out I drop about 6fps for every character I put in a level with this shader. Any ideas on a) why it is dropping the framerate so much and b) how to fix it?

AE

Demon Air 3D
15
Years of Service
User Offline
Joined: 16th Sep 2008
Location: England
Posted: 30th Dec 2008 18:39 Edited at: 31st Dec 2008 15:43
thanks alot lol that was what i did in the first place
bond1
18
Years of Service
User Offline
Joined: 27th Oct 2005
Location:
Posted: 30th Dec 2008 19:16 Edited at: 30th Dec 2008 19:23
Quote: "This is an excellent looking shader, but it slows down my levels a lot. I put two characters in a room, and assigned this shader to them and I got 20-21 fps solidly"


Quote: "I've worked out I drop about 6fps for every character I put in a level with this shader. Any ideas on a) why it is dropping the framerate so much and b) how to fix it?"


That's because this shader is offloading character skinning to the CPU, instead of performing it on the GPU where it is much faster. I looked at the vertex shader, and there is no skinning code in there, it is just passing vertex position over to the pixel shader. Take a look at the "fastbone" and "bumpbone" shaders, specifically the vertex shader portion to see what modifications you would need. Or if you have my wizard staff shader from the store, it has the modifications you would need as well.

This shader works best for dynamic entites that AREN'T characters. Good job getting this shader into FPSC though, not the easiest thing to do!

----------------------------------------
"bond1 - You see this name, you think dirty."
CoffeeGrunt
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location: England
Posted: 31st Dec 2008 20:23
Quote: "Or if you have my wizard staff shader from the store,"


Lol, good advertising...

Quote: "This shader works best for dynamic entites that AREN'T characters."


EXACTLY what I needed, I'm gonna try this out...this is an awesome shader RW, you've done something which I could never understand, I'm only editing values of stuff to get results lol, great job!

Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 31st Dec 2008 21:41
Dont do it CG! I ran it on one of CP's entities and it ate up my framerate if i tried to even get close to it(even look at it). I was about a segment away and i was at 3fps...on a level that ran(when i wasnt looking at it) at 31fps. Two segments away i was at 10fps and three segments away i was at 20fps. but man did it look nice.

I know not with what weapons WWIII will be fought but WWIV will be fought with sticks and stones-Albert Einstein
CoffeeGrunt
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location: England
Posted: 31st Dec 2008 21:53
Hmm, I'll try it out on my PC...

In a 3x3 room, with one light, on ten barrels it ran at:

159-161 fps with no shaders,

100-130 fps with the BumpCubeReflectAlpha shader,

90-93 fps with this shader.

My PC specs:



Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 31st Dec 2008 21:57
well my machine sucks so i dunno maybe its just my graphics card(GeForce5200FX).

I know not with what weapons WWIII will be fought but WWIV will be fought with sticks and stones-Albert Einstein
CoffeeGrunt
16
Years of Service
User Offline
Joined: 5th Oct 2007
Location: England
Posted: 31st Dec 2008 22:01
Ahh, perhaps...

I had that one, it sucked with shaders too lol...

Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 31st Dec 2008 22:03
hopefully ill get a new pc for BDay...but of course thats the day that standardized testing begins where i live.

I know not with what weapons WWIII will be fought but WWIV will be fought with sticks and stones-Albert Einstein
Strelok
17
Years of Service
User Offline
Joined: 16th Oct 2006
Location: In your cupboard.
Posted: 1st Jan 2009 02:39 Edited at: 1st Jan 2009 02:40
Thank you very much for this , this looks very useful !

Roger Wilco
18
Years of Service
User Offline
Joined: 6th Jul 2005
Location: In the Shadow of Chernobyl
Posted: 1st Jan 2009 13:26
Whoa, what a load of replies! I never expected so much response, lol.

@Matuka: Thanks! Well, I'm not sure parallax mapping would work correctly in FPSC, since it requires an extra camera to create the illusion of depth. Or maybe I'm confusing parallax with relief? I'm not sure. :S

@Demonair: Yeah, what Avenging Eagle said. Create a folder with the same name as the shader under the effects bank, and it should work fine. Good to note for future problems.

@bond1: Ah, I see. Thanks for the tips, I'm still very novice when it comes to shaders. I'll look deeper into the numbers and letters and see if I can fix the performance problem.

@Dar13: The 5200 isn't really the best piece of hardware, so it might partially explain why you're getting such low framerates. But as I said, I'll look into optimizing the shader. Hopefully it will perform better.

I haven't noticed any serious framerate reduction myself, since I'm on a pretty high-end-ish machine, so I never gave it much thought. But I will now.

@Strelok: Thanks for the kind words!

Avid
16
Years of Service
User Offline
Joined: 24th Jun 2007
Location:
Posted: 1st Jan 2009 14:06
Make it GPU rather than CPU dependant and you'll be onto a winner there.

Visit my site http://www.fpsmodels.com for models and media for fps creator.
Cheese Cake
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location: At the bakery
Posted: 1st Jan 2009 16:26
Looking great man! Will try this out soon!

Guy_84
15
Years of Service
User Offline
Joined: 11th Nov 2008
Location: Carbondale, PA
Posted: 1st Jan 2009 18:26 Edited at: 1st Jan 2009 18:27
WOW! That's amazing! I'll try out this shader ASAP.

All your base are belong to us.
Gunn3r
17
Years of Service
User Offline
Joined: 12th Jun 2006
Location: Portland, OR
Posted: 1st Jan 2009 20:14
Wow. So this is the final product of the shader you showed me that long ago! How's it going, buddy? Haven't seen you online in a while.

I will be messing with this shader and trying to get it into at least one of my future games.

Gunn3r Games
Cosmic Prophet
16
Years of Service
User Offline
Joined: 17th Mar 2008
Location: The Cosmos
Posted: 1st Jan 2009 20:52
Nice Work Roger W. I get around 29fps on my IMac, Which is not too bad. Looking forward to seeing further refinements, Good Job! Good to see you back in action. Happy New Year!

In the Universe, nothing ever stays the same.
SikaSina Games
16
Years of Service
User Offline
Joined: 5th Dec 2007
Location: Reading, UK
Posted: 1st Jan 2009 22:04
I've tried to get my own shader into FPS Creator but it never worked lol . How did you do this? Great work though!

-FCV

heltor
16
Years of Service
User Offline
Joined: 3rd Oct 2007
Location: cyberspace
Posted: 2nd Jan 2009 03:28
Cosmic Prophet is the mac Daddy.....lol

Great spirits often encounter violent opposition from mediocre minds.

Login to post a reply

Server time is: 2024-04-24 16:28:54
Your offset time is: 2024-04-24 16:28:54