Thinking of creating a sun

Blitz3D Forums/Blitz3D Programming/Thinking of creating a sun

Yue(Posted 2013) [#1]
That way there is to make a sun, with a sprite, but the camera when viewing hoops look sunbeams.

I do not know if I understand well, speak of a sun where their rings are around when the camera is focused on.


GfK(Posted 2013) [#2]
Lens flares.

There's some in the code archives.


Kryzon(Posted 2013) [#3]
+1 on the flares.
If you're using FastEXT you can also turn on the 'GodRays' post effect:
http://fastlibs.com/gallery.php (picture on the third row, extreme right)


Yue(Posted 2013) [#4]
Yes GFX, it's Lens Flare.

i use fastext test 5 minutes.




RemiD(Posted 2013) [#5]
There is also the "Fredborg sun effect", see :
http://www.youtube.com/watch?v=uuccl9ywyKQ (from 00m15s to 00m19s)

I am not sure how he did it, i guess he has used a subdivided quad in front of the camera, child of the camera, and several linepick from the sun to the quad to check if a ray manages to reach each part of the quad, then color the quad accordingly.


Yue(Posted 2013) [#6]
This is really hard, take other people's code and try to accommodate what I do.

For now running tests.




Yue(Posted 2013) [#7]
Help code translate to sprites 3D. Please.

Function updateflare(camera,source)
	CameraProject camera,EntityX(source,1),EntityY(source,1),EntityZ(source,1)
	x#=ProjectedX()/viewx
	y#=ProjectedY()/viewy
	
	;if on screen	
	If (x>0 And x<=1) And (y>0 And y<=1)
		
		;-1 to 1
		xoffset# = (x-0.5)*2
		yoffset# = (y-0.5)*2
		
		;notes:		
		
		;Flares: (use sprites and a sprite lib to translate from 3D to 2D.
		;For now, we use 2D to illustrate. Multiply offsets however you like.
		;Oval coords corrected for offset - not needed with 3D sprites.
		
		
		;flare 1
		flare1_x# = (viewx/2) - (xoffset*640)
		flare1_y# = (viewy/2) - (yoffset*320)
		
		
		
		Oval flare1_x-16,flare1_y-16,32,32,0
	
		
		;flare 2
		flare2_x# = (viewx/2) - (xoffset*64)
		flare2_y# = (viewy/2) - (yoffset*32)
		Oval flare2_x-100,flare2_y-100,200,200,0
		
		;flare 3
		flare3_x# = (viewx/2) - (xoffset*500)
		flare3_y# = (viewy/2) - (yoffset*250)
		Oval flare3_x-64,flare3_y-64,128,128,0
		
		
	EndIf
End Function





Yue(Posted 2013) [#8]
Ok, no problem, problem now it's Glow ON.

Glow OFF.




Problem Glow ON :(




Kryzon(Posted 2013) [#9]
You need a double pass:

[Glow + shadows + other filters ON]
- Hide lens-flares sprites.
- Show everything else.
- Set camera cls mode to CameraCLSMode(camera, True, True)
- RenderWorld()

[Glow + shadows + other filters OFF]
- Show lens-flares sprites.
- Hide everything else.
- Set camera cls mode to CameraCLSMode(camera, False, True) ;Preserve what was on screen.
- RenderWorld()


PS: The lens-flare code you're using does not take into account if the sun is occluded (hidden) by an obstacle.
I don't know if you'll understand this, but if you look through a wall towards the sun you will have the flares showing when you really shouldn't. You need to do a linepick from the camera to the sun and see if it catches any obstacles.


Yue(Posted 2013) [#10]




You're right, behind a wall flares are ... :( , I will investigate on linepick. Thanks Men.