Please use english language
It is currently 21 Oct 2017, 10:26

All times are UTC





Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: [FO4] Flares enblens.fx
PostPosted: 19 Dec 2016, 13:53 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
Code:
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//                                                                  //
//  Flares enblens.fx by kingeric1992                               //
//                                                                  //
//  Featuring:                                                      //
//      Fully customizable lens flare with the capability of        //
//  achieving multiple visual representation of various lens flares //
//  observed in physical cameras.                                   //
//                                                                  //
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//

demo shots:
Image
Image
Image
Image

Select "lens" in technique under [ENBLENS.FX]
Attachment:
File comment: update: Dec.19.2016
enblens.fx [18.5 KiB]
Downloaded 133 times

For noise dispersion, download noise texture here http://i.imgur.com/zPkMJyb.png and rename it to enbGrain.png
(will try to do procedural noise in the future)

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Top
 Profile  
 
Tomoko
PostPosted: 19 Dec 2016, 15:00 
Offline
*sensei*
User avatar

Joined: 30 Jan 2012, 13:18
Posts: 463
Great work once again!
For procedural noise, try simplex noise or radical inverse, both have noise profiles that fit this purpose very well. For simplex, Cryengine V source had a short and clean implementation as opposed to some shadertoys. Just in case you don't want to write it yourself, that is.

Don't use radians(), it's slow and generates dozens of instructions, just multiply by pi/180 and you're fine. I know you're not micro optimizing your shaders but that's what jumped my eye.


Top
 Profile  
 
PostPosted: 19 Dec 2016, 15:10 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
The thing is, I need to wrap this thing right now before I lose my interest and buried it in my hard drive forever...along with several other 90% finished effects...

About radians(), it is multiply the input by 0.017453, which is PI / 180.

To optimize further, I can move the vertices computation to vertex shader, but probably not much to gain on frame rate wide.

Btw, in dx9 static computation such as this is handled by preshader and only execute once per frame, in dx10 and later, it is computed per pixel, including DNI separation ops.

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Last edited by kingeric1992 on 19 Dec 2016, 15:23, edited 1 time in total.

Top
 Profile  
 
PostPosted: 19 Dec 2016, 15:22 
Offline
*sensei*
User avatar

Joined: 30 Jan 2012, 13:18
Posts: 463
Heh, I know that. Trying some super complex project: ah yiss.
Once you manage to do it, interest drops to 0. I have a metric ton of shader stuff on my HDD that isn't really polished enough for release so I'm too lazy to finish it.

About radians, according to Pherson's Low level thinking, it doesn't do that, but creates dozens of instructions instead and that's coherent with some tests I did a while back with my old DOF.

At least we have a lot more instructions etc possible in DX11 so one could theoretically do all DNI TOD separation in vertex shader.


Top
 Profile  
 
PostPosted: 19 Dec 2016, 17:19 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
Code:
float4 PS_Test( float4 pos : SV_POSITION, float2 txcoord : TEXCOORD0) : SV_Target
{
    return radians(test);
}

is just a single mul instruction.
Code:
mul o0.xyzw, cb0[0].xxxx, l(0.017453, 0.017453, 0.017453, 0.017453)

The same goes to dx9.

(btw, atan takes 32 instructions)

I guess they just said that for preference, thinking the operation is easy enough that using build-in function is a shame or something.

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Top
 Profile  
 
PostPosted: 19 Dec 2016, 17:44 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 31 Mar 2012, 15:06
Posts: 1425
Location: France
Fantastic. No other word.
Ah, yes : THANK YOU.

_________________
Obsidian 900D, AX1500i, Eisbaer 420, i7 6850K@4.425 Ghz, MSI X99 Raider, SLI 2x1080Ti 11G VRAM, 32G RAM@3371, 950 Pro M2, 10 Tb HDDs, W10 Pro 64
Image
K ENB Pure Light SE
K ENB Pure Light
Kountervibe ENB
Kinematic ENB


Top
 Profile  
 
PostPosted: 19 Dec 2016, 18:19 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 31 Mar 2012, 15:06
Posts: 1425
Location: France
One question, though : can we set your passes of techniques after those from original enb lens shader, renaming them to continue after

technique11 MultiPassLens3
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0, VS_Quad()));
SetPixelShader(CompileShader(ps_5_0, PS_LensMix()));
}
}

as ' MultiPassLens 4, 5, and so on ? and modifying their VS and PS shaders, of course.
Guess that yes, as vertex shader and structures are different...

_________________
Obsidian 900D, AX1500i, Eisbaer 420, i7 6850K@4.425 Ghz, MSI X99 Raider, SLI 2x1080Ti 11G VRAM, 32G RAM@3371, 950 Pro M2, 10 Tb HDDs, W10 Pro 64
Image
K ENB Pure Light SE
K ENB Pure Light
Kountervibe ENB
Kinematic ENB


Top
 Profile  
 
PostPosted: 19 Dec 2016, 18:40 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
you need to set render target here to store the frame at somewhere else,

technique11 MultiPassLens3 <string RenderTarget="RenderTargetRGBA64F";>

then blend it back later on with

color += RenderTargetRGBA64F.Sample(Sampler1, coord);

As I'm using the swap chain, anything written on it will be overwritten during the process.

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Top
 Profile  
 
PostPosted: 19 Dec 2016, 18:51 
Offline
*blah-blah-blah maniac*
User avatar

Joined: 31 Mar 2012, 15:06
Posts: 1425
Location: France
Ok. I see. Thank you !
Do you advice setting your passes of technique after Enb's or the other way around ?
I guess yours after, right ?

_________________
Obsidian 900D, AX1500i, Eisbaer 420, i7 6850K@4.425 Ghz, MSI X99 Raider, SLI 2x1080Ti 11G VRAM, 32G RAM@3371, 950 Pro M2, 10 Tb HDDs, W10 Pro 64
Image
K ENB Pure Light SE
K ENB Pure Light
Kountervibe ENB
Kinematic ENB


Top
 Profile  
 
PostPosted: 19 Dec 2016, 20:26 
Offline
*sensei*

Joined: 05 Apr 2014, 10:29
Posts: 496
Location: Taiwan
It doesn't matters, both ways are fine.

It is also possible to have them running parallel.
I might as well add it in future update.

_________________
Intel Xeon L5639 6C12T @3.96GHz // Gigabyte ga-x58a-ud3r// MSI GTX680 4G// 24G RAM
Flickr
YouTube


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2, 3  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group