Fake Light Shafts (Downlaod available)

Posted By: Enduriel

Fake Light Shafts (Downlaod available) - 06/20/09 08:18

EDIT 2:

Well here it is, excuse my understanding of post processing and HLSL, it's my first time smile

So if there are bugs, it's probably over the top of my head on how to fix them.

Anyhow I hope it's usefull smile

Download shader: http://files.filefront.com/LightShaftrar/;13920138;/fileinfo.html





EDIT:

The lightshaft shader is done, though it very messy atm, I need to clean it up abit and find a better solution for making the VIEW that is being rendered black contain the same position and angles as the real scene, cause right now I do a while loop with ViewBlack.x = camera.x etc which is not nice, but hey, i'm a novice in HLSL and this was the solution I found for myself smile

I'll release it soon, just need to extract it out of my project and make it standalone with a small level, and probably some solution for that camera position / angle problem first!

Link: http://www.youtube.com/watch?v=-vZjq-K3nS0

NEW HD: http://www.youtube.com/watch?v=LBdlulbYNgI








Original post

Hello people, I'm using Nils "Slin" Daumanns radialblur shader and his God Ray IDEA to make Fake Light Shafts. I just extended it alittle bit with lite-c for making it stick to the sun_pos and fade out/in on screen corners.

http://www.youtube.com/watch?v=bWkfFrvWCJg

My problem is rendering the entire scene black except the SKY.
If I can get that to work, from there on I can handle the rest, but I have no clue on how to render everything except the SKY black into a texture. So being stuck at Step 1 kinda sucks =/

If I could get some help on that, I could handle the rest, as what's left to do from there on would be passing it as mtlSkin1 to the GodRay PP shader and then radialblur it and additive/screen blend it with the rest of the scene.

I also plan on releasing it as a small contribution from my side smile
Posted By: XD1v0

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 09:08

Quote:
but I have no clue on how to render everything except the SKY black into a texture

Very easy do this, just do far negative fog, like this
Code:
technique black
{
	pass p0
	{
		AlphaBlendEnable=True;  
		Zenable = True;
		ZwriteEnable = True;
		BlendOp=Add;
		Lighting=False;
		
		FogEnable = True;
		FogColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
		FogStart = 60000;
		FogEnd = 50000;
		
		
		ShadeMode = Flat;
		ColorArg1[0] = Diffuse;
		ColorOp[0] = SelectArg1;
	}
}


set this material to view
Posted By: Hummel

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 15:47

Since itīs just a negative fog, not everything except the sky will became black...try to add a viewdependent material or something like this...

At least Crysis already generated the shafts this way, but Slin did a great job too wink

Posted By: Enduriel

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 17:02

XD1v0: Hey, thanks for your help but that only makes the entire scene black except the panels and texts. Though I tried that with a normal lite-c fog with NOFOG flag enabled on the sky and it worked, but as you know I need it through a shader, and the one you contributed didn't work for me frown

Hummel: I wish I had the knowledge to do that smile I'm a novice in HLSL and this is the first time I tackle it =], though if I could get the above code to work, then I would be fine as the rest is easy =]


EDIT: I think I need a second view with lite-c fog for this to work, atleat with my knowledge, would be lovely though if someone could point out what I was doing wrong with XD1v0s code frown
Posted By: XD1v0

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 20:04

Quote:
could point out what I was doing wrong with XD1v0s code

Ops, sorry i give you wrong shader code, now its work fine


Code:
texture entSkin1;

technique black
{
	pass p0
	{
		AlphaBlendEnable=True;  
		Zenable = True;
		ZwriteEnable = True;
		BlendOp=Add;
		Lighting=False;
		
		FogEnable = True;
		FogColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
		FogStart = 60000;
		FogEnd = 50000;
		
		ShadeMode = Flat;
		Texture[0] = <entSkin1>;
		ColorArg1[0] = Texture;
		ColorOp[0] = SelectArg1;
	}
}



Posted By: Enduriel

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 20:17

Lovely! It works smile Just a quick question though, it works only with bitmap skies, is there a way to make it work with model based skies aswell? Not needed but I just wonder smile

EDIT: Nvm got it to work with models aswell smile
Posted By: Enduriel

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 22:37

The lightshaft shader is done, though it very messy atm, I need to clean it up abit and find a better solution for making the VIEW that is being rendered black contain the same position and angles as the real scene, cause right now I do a while loop with ViewBlack.x = camera.x etc which is not nice, but hey, i'm a novice in HLSL and this was the solution I found for myself smile

I'll release it soon, just need to extract it out of my project and make it standalone with a small level, and probably some solution for that camera position / angle problem first!

Witness the rays of GOD: http://www.youtube.com/watch?v=-vZjq-K3nS0

NEW HD: http://www.youtube.com/watch?v=LBdlulbYNgI
Posted By: Quad

Re: Fake Light Shafts ( almost done, just a problem ) - 06/20/09 22:50

this is what i was talking about on the youtube comment of the previous video wink looks nice
Posted By: MMike

Re: Fake Light Shafts ( almost done, just a problem ) - 06/21/09 19:29

Oh nice, this was something i was looking for , God Shaders. Though i think the rays are too much radial blured... maybe there could be attenuated usng a distance, calculation, depth view.

Because the rays are due to air dust, or other occlusion particles, and the ray will accumulate more and more opacity the more distant it gets, thus, dimming the light.
Posted By: HeelX

Re: Fake Light Shafts ( almost done, just a problem ) - 06/21/09 21:12

Looks really nice! Which shader model do you use?

Are you planning to contribute this? What is required to get it work (what do I have to do later when I'll try to add this to my scenes)?

Best regards,
Christian
Posted By: Enduriel

Re: Fake Light Shafts ( almost done, just a problem ) - 06/21/09 21:31

it's shader model 2.0.

I'm gonna explain everything with a test level to get it to work, I'll contribute it within a few hours smile
Posted By: Enduriel

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 01:54

Well here it is, excuse my understanding of post processing and HLSL, it's my first time smile

So if there are bugs, it's probably over the top of my head on how to fix them.

Anyhow I hope it's usefull smile

Link: http://files.filefront.com/LightShaftrar/;13920138;/fileinfo.html
Posted By: darkinferno

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 03:07

this looks great.. i wouldnt call it fake, it works for the style you want, waht determines real or fake?.. alot of AA companies "fake" things.. xept, we dont know about it because it works... anyways, i couldnt get it to work as in your demo but maybe its some things in my code affecting it.. cant be sure yet... anyways... looking great, your project almost looks AAA too.. graphically atleast...

conitec should use videos like these and give torque a run for their money smile
Posted By: Germanunkol

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 07:52

awesome work!

Only crit from my side is that the player REALLY needs a shadow. but that's not what you were showing in these videos, so it's good. Nice!
Posted By: Cowabanga

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 08:11

Looks cool!!
Posted By: the_clown

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 08:19

Looks cool indeed!
Posted By: bart_the_13th

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 10:38

Very nice!!!

@darkinferno: It's called fake because it actually emulate the volumetric light using zoom shader.

BTW, I wonder if you can use this for flashlight too...
Posted By: MMike

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 12:30

ptty it does not shows on my laptop, i cant see the sun neither blur, or any post effect. :\ i thought i had shader model 2
Posted By: Anonymous

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 14:27

to prevent the one frame behind update of the blackView position try to use the CHILD flag for the view.
Posted By: MMike

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 20:28

is that for me? which view exaclty? i see no effect.
Posted By: lostclimate

Re: Fake Light Shafts ( almost done, just a problem ) - 06/22/09 22:48

definately nice, bet chris is glad to see this laugh
Posted By: Anonymous

Re: Fake Light Shafts ( almost done, just a problem ) - 06/23/09 13:36

i mean not you mike, In the demo if you move the camera, you see the blocks a second time, but one frame behind.
Posted By: MMike

Re: Fake Light Shafts ( almost done, just a problem ) - 06/24/09 01:18

how do i disable that then? i do see the blocks , nothing is black..
Posted By: DanielTruong

Re: Fake Light Shafts ( almost done, just a problem ) - 06/28/09 08:06

Oh ! Sorry but I got a problem when compile that code :


ptr_remove -> Undelare... so.. how to fix it ?

and another error is : SHOW is undeclared !

In that code i found no any function named ptr_remove !
Posted By: Cowabanga

Re: Fake Light Shafts ( almost done, just a problem ) - 06/28/09 08:40

That because you have an old version. What's your version??
Posted By: the_mehmaster

Re: Fake Light Shafts ( almost done, just a problem ) - 06/28/09 09:17

the SHOW flag is defined in version 7.70. upgrade to that version or higher.
Posted By: MMike

Re: Fake Light Shafts ( almost done, just a problem ) - 06/29/09 00:22

eh: Cowabanga you truly are a wrz hunter.
Posted By: the_mehmaster

Re: Fake Light Shafts ( almost done, just a problem ) - 06/30/09 03:54

Quote:
eh: Cowabanga you truly are a wrz hunter.

What's wrong with that? I don't like wrz people either...
Posted By: MMike

Re: Fake Light Shafts ( almost done, just a problem ) - 07/04/09 23:49

nothing..nothing wrong, Im just telling him, he has a good eye for that stuff
Posted By: Jaeger

Re: Fake Light Shafts ( almost done, just a problem ) - 07/07/09 10:04

That's hardly an indication of "wrz". I had a similar problem with the "SHOW" flag and some others a while back. Then I realized that I was actually using an older version, and had incorrectly installed my updated version (mixed folders all up and over-wrote things). I always keep old versions to run old projects. So, I wouldn't start trying to jump on people or say things like that. Maybe you're the "wrz wizard" trying to take the focus off yourself and your guilty conscience! smile (<- kidding about last sentence, lol.)

So Daniel, try re-updating your installation if you haven't already. Just go to the main page, and do the free A7 download. If you've got a legit version of 3DGS, it will work fine. If you don't, then well... anything could happen, lol. Bewarez! (<- translation: Beware of "wrz"!, lol)
Posted By: Puppeteer

Re: Fake Light Shafts ( almost done, just a problem ) - 07/22/09 21:54

The light shafts only work in video_mode=8...
Posted By: PadMalcom

Re: Fake Light Shafts ( almost done, just a problem ) - 06/14/13 08:57

Does anybody still have access to this shader?
Posted By: 1234David

Re: Fake Light Shafts ( almost done, just a problem ) - 04/23/14 06:27

For me to, please.
All the links are down. frown
Posted By: Ch40zzC0d3r

Re: Fake Light Shafts ( almost done, just a problem ) - 04/23/14 10:00

Just use the one from shade-c? shocked
Works fine for me laugh (didnt even include shade-c, just ripped the shader + setup)
Posted By: Emre

Re: Fake Light Shafts ( almost done, just a problem ) - 04/23/14 12:06

also hummel's shader is works perfectly.

Posted By: 1234David

Re: Fake Light Shafts ( almost done, just a problem ) - 04/24/14 06:39

@Ch40zzC0d3r
There are to much shader to see the right one... o.O
^^Not really. There are some significant bugs and the shader react after one or two frames when I'm moving the camera in an computer with low performance.

@Emre
I don't know this project in the picture.
But if you mean the demos like "wavefield" there is some code which is compiled or missed like "defines.c", "PP_Helper.c", "material_events.c" and "materials.c". frown
Posted By: Emre

Re: Fake Light Shafts ( almost done, just a problem ) - 04/24/14 13:24

Here we go; http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=307327&page=all
Posted By: sivan

Re: Fake Light Shafts ( almost done, just a problem ) - 04/24/14 14:37

the file there is not available, can you re-upload Emre?
Posted By: Emre

Re: Fake Light Shafts ( almost done, just a problem ) - 04/24/14 15:38

Yes of course! Here we go

But remember, if you're gonna use it, you may have to re-organize your other shaders. out Color1 must be black.

Html:
//for example your tree or terrain or building shader
void PS_PASS1( in float2 Tex0:TEXCOORD0, out float4 ocolor0 :COLOR0,out float4 ocolor1 :COLOR1 )
{
	
	float4 color = tex2D(ColorMapSampler, Tex0);
	ocolor0= color;
	ocolor1=float4(0,0,0,1);
}

Posted By: 1234David

Re: Fake Light Shafts ( almost done, just a problem ) - 04/24/14 16:36

COOL! TANKS A LOT EMRE!!! xD
Posted By: Emre

Re: Fake Light Shafts ( almost done, just a problem ) - 04/24/14 20:18

You are welcome. My thanks go to Hummel and Slin. laugh
Posted By: 1234David

Re: Fake Light Shafts ( almost done, just a problem ) - 07/23/14 11:57

Ok, I found a problem in the LS-Shader. If I use a realtime-mirror, then the LightShafts doesn't work correctly: The screensize is scaled to the size of the realtime-mirror-view and I see only the full sun (no raysplitting at objects).

I used the predefined mirror from gamestudio.

But I can't find the differences in the shaders. The mirror is rendering in an extra-view and to the model (floor, water...), and the LS renders to the camera.
© 2024 lite-C Forums