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.

DarkBASIC Professional Discussion / Advanced sun with crerays and blur... a little understanding :)

Author
Message
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 21st Apr 2011 07:12 Edited at: 21st Apr 2011 07:21
I am trying to create - not use someone else's - but create a sun shader (solar rays, distortion from heat / haze and so on.)

Okay - first of all I've seen it done and I have been following a how to from http://xnameetingpoint.web.officelive.com/EnglishSunShader.aspx. I need to understand what is being done and why and It would be super helpful if someone can explain what this page is instructing... render targets, mipmapping and so on.

(That is to say the page explains how it was done and not clearly enough to learn how to do it! :X)

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 21st Apr 2011 17:46
A) I think that guide shows you how to implement a sun shader, not make one.
Quote: "I then wrote a shader that only passes pixels with a brightness greater than 1.0 to the screen, i.e. some kind of binary "and" operation applied to pixels."
Case in point. He shows you how to use his shader.

B) If you don't understand what mipmapping and render targets are, then how do you expect to program an entire shader? I understand everything he was talking about, and I wouldn't attempt to write a shader! This was actually a well described step by step tutorial on how to use it, though.

I don't know what you do and don't know, but here's some of the things he was talking about.

Texture map-The image that appears on a 3d object.

Gaussian filter-A 2d graphics filter used to blur an image.

Render target-The object focused on by the shader/camera.

Mipmapping-A technique used to stop swimming pixels and increase render time by scaling the image down, and comparatively blending adjacent pixels to soften the image. The further from the camera the object is, the smaller the mipmap texture used is.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 21st Apr 2011 19:25 Edited at: 21st Apr 2011 20:04
I have written shaders. In fact I've even fooled around with some of G.G.'s advanced shaders - made a simple whirlpool shader - the list is long.

What I am trying to understand is how to mip-map and use a render target to apply the blur and crepuscular rays. If I can understand how these things are done - I can learn from the link I posted above... but alas, I need someone to "take a step down" before I can "take a step up" lol.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2011 20:05
Why not just use evolved's advanced lighting library which does it all for you?

My signature is NOT a moderator plaything! Stop changing it!
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 21st Apr 2011 20:29
OH - lol I'll take a look - again, I am trying to understand implementation for the sake of understanding and not execution LOL - silly me didn't even know this existed...

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 21st Apr 2011 21:16 Edited at: 21st Apr 2011 21:43
Oh, My bad. You sounded a little green in your first post. Okay, stepping up the help a notch.

Mipmapping is simple, you just have to have different size texture maps for different distances. You know, 256x256 for close ups, 64x64 for mid ranges, 32x32 for farther, etc.

And, I'm sure the rays are driven by the shader itself, as there was no description on how to create them, apart from having opaque textures to blot out some of the rays cast by the shader.

Also, the render target isn't what's used to blur the image. He used good ol' fashioned graphics editing! With what design tool? Maybe Illustrator I'd guess. I'm messing around to find his blending method. When I figure it out, I can explain it.

[EDIT] There was a description on creating them! Haha. My bad. Also, after messing around with Paint(dot)net, I sort of figured it out, but the Gaussian filter in Paint(dot)net suuuuuuuucks! *lot's of emphasis on 'sucks'*

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 21st Apr 2011 21:28 Edited at: 22nd Apr 2011 00:20
OKAY! - I think I've got the sub sampling or mip mapping down - its additional passes right? and the output is just *0.25 or 0.5 or 0.125 and so on and so forth - which scales it down to the power of two.

I imagine for the rays it has to go with bilboarding and samples... the more samples there are, the further the rays extend... don't know about this part...

The trickiest part I think as all shader writing goes - will be putting the whole bit in sequence... and fine tuning... but I digress.

I'll keep reading around. Not much luck on mip mapping - ugh... don't you love it when you want to learn something new and find when it comes to .fx you're always a noob Argh.

edit-
Okay I really should have taken the time to write a few full screen shaders. Lord and there's texels and oi - cig. time!

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
18
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 25th Apr 2011 10:59
Okay - I need some help with this. I dont understand how to achieve the result that the creator of the shader (first post) did. I understand whats involved - but not why or how to do it. I need some learning and although I've been reading up - i wonder if anyone out there can jump off floor 100 and meet me at 1 and help me work my way up... more like 25 up to 100 LOL!

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.

Login to post a reply

Server time is: 2026-07-18 06:41:24
Your offset time is: 2026-07-18 06:41:24