Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,574 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: possible to add proper spotlight support to this shader? [Re: Kartoffel] #402705
06/09/12 14:37
06/09/12 14:37
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Originally Posted By: Kartoffel
Well I'm not using level-blocks in WED. I'm only using models for my whole levels. (some models have static-lightmaps)

I didn't test it, but I'm pretty sure just setting the LevelBlock's material to the lighting-shader won't work.
I've never written a shader for level blocks, but I think they work different.

If you want to use LevelBlocks you have to use the standart lighting.
The default engine lighting for level blocks shouldn't be that bad.


by looking at specBump.fx it seems that blocks have their normal map on entSkin3 instead of entSkin2. Maybe creating a variant for blocks where the color map alpha is used for specular and entSkin3 is used for normal would work properly

edit: I could get it working in blocks by commenting the define on line 13 (#define SPECULAR_ESKIN3) and in line 77 (inside NormalMapSampler) changing Texture = <entSkin2>; by Texture = <entSkin3>;

Now if the shader could use color map alpha for specular it would be perfect

Last edited by painkiller; 06/09/12 14:43.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: possible to add proper spotlight support to this shader? [Re: painkiller] #402709
06/09/12 15:31
06/09/12 15:31
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
change line 163 to
Code:
float4 EffectMask = Color.a;


If you now uncomment #define SPECULAR_ESKIN3 (should be @line13)
the alpha-channel of the color map is used as Specular-intensity

give it a try!

Last edited by Kartoffel; 06/09/12 15:32.

POTATO-MAN saves the day! - Random
Re: possible to add proper spotlight support to this shader? [Re: Kartoffel] #402711
06/09/12 15:52
06/09/12 15:52
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
works perfectly! thank you very much!


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: possible to add proper spotlight support to this shader? [Re: painkiller] #402712
06/09/12 15:55
06/09/12 15:55
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
The shader looks great in my test program.

Unfortunately in MM3D the character gets very dark when adding the shader to it.

Maybe I have to play around with the intensity values a bit? In MM3D we the sunlight is set to 0,0,0 maybe that's the reason.

Re: possible to add proper spotlight support to this shader? [Re: painkiller] #402713
06/09/12 15:55
06/09/12 15:55
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Thats nice!

Could you upload the modified .fx-file?
Then I'll delete everything which isn't used anymore.
(And I can use it, too grin )

Last edited by Kartoffel; 06/09/12 16:01.

POTATO-MAN saves the day! - Random
Re: possible to add proper spotlight support to this shader? [Re: Kartoffel] #402714
06/09/12 16:04
06/09/12 16:04
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Originally Posted By: Kartoffel
Thats nice!

Could you upload the modified .fx-file?
Then I'll delete everything which isn't used anymore.
(And I can use it, too grin )


Here it is a demo based on spot.c form samples folder. There are two variations of the original .fx, one which uses alpha as specular, and another one which I also modified for blocks ( just changing entSkin2 by entSkin3 in the NormalMapSampler ). In the scene there are two blobs, one is a model and the other one is a block.

Download link: http://www.mediafire.com/?3wbdk4cwyex9pnj

Last edited by painkiller; 06/09/12 16:05.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: possible to add proper spotlight support to this shader? [Re: painkiller] #402719
06/09/12 16:56
06/09/12 16:56
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
hey!
i found a bug:
you set Color.a = fAlpha, but you never set fAlpha
i fixed it with adding fAlpha = Color.a in the line after setting Color to the current texture pixel


Visit my site: www.masterq32.de
Re: possible to add proper spotlight support to this shader? [Re: MasterQ32] #402736
06/09/12 18:25
06/09/12 18:25
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
@Master032: Can you give us the line where to add the line?

Re: possible to add proper spotlight support to this shader? [Re: pegamode] #402739
06/09/12 18:38
06/09/12 18:38
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Color.a = fAlpha; applies the Entity.alpha to the output color
with this you can make the entity transparent when decreasing the .alpha value of the entity

This line isn't wrong...

(Colormap alpha isn't supported, yet)

Quote:
you set Color.a = fAlpha, but you never set fAlpha

fAlpha is passed by the engine to the shader. It contains the entity.alpha value with the range [0-1]

Last edited by Kartoffel; 06/09/12 18:40.

POTATO-MAN saves the day! - Random
Page 3 of 3 1 2 3

Moderated by  Blink, Hummel, Superku 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1