Page 1 of 1

CreateLensFlareEffect

Posted: Fri Apr 11, 2014 2:59 pm
by Lexicon
Hi!
My LensFlares is under terrain and over the objects. :|

Image
http://radium3dengine.com/img/shot_2014 ... -43-31.jpg

Code: Select all

CreateNode(5, 0, 100, 0)
GetScriptMaterial(5, "PE/lensflare")
GetScriptMaterial(6, "PE/ringflare")
GetScriptMaterial(7, "PE/ringflare2")
CreateLensFlareEffect(5, CameraID(0), NodeID(5), 20, 50, MaterialID(5), MaterialID(6), MaterialID(7))
Typical material

Code: Select all

material PE/lensflare
{
	technique
	{
		pass
		{
			lighting off
			depth_write off
			scene_blend add

			texture_unit
			{
				texture flare.png
			}
		}
	}
}
What's wrong I do? Please help. Terrain is not a system terrain. This is a mesh.

Oops... Sorry... Please move this topic to 3D Programming. My brain is broken totay.

Re: CreateLensFlareEffect

Posted: Sat Apr 12, 2014 7:23 am
by Samuel
In your material script instead of depth_write off try depth_write on.

Re: CreateLensFlareEffect

Posted: Sat Apr 12, 2014 9:09 am
by Lexicon
Samuel wrote:In your material script instead of depth_write off try depth_write on.
No, Samuel. Not solved. :(

http://radium3dengine.com/img/shot_2014 ... -58-58.JPG

Re: CreateLensFlareEffect

Posted: Sat Apr 12, 2014 1:54 pm
by applePi
may be you need the line "depth_check off" or "depth_check on" after "depth_write off ", i never tried lensflare before
look the LensFlare.material here:
http://www.ogre3d.org/forums/viewtopic.php?f=11&t=65630
there is material LensFlareHalo , material LensFlareCircle, material LensFlareBurst
but the 3 LensFlare textures are not available, i found it here
https://github.com/petrocket/salvation/ ... s/textures

Re: CreateLensFlareEffect

Posted: Sat Apr 26, 2014 6:24 am
by Lexicon
applePi wrote:may be you need the line "depth_check off" or "depth_check on" after "depth_write off ", i never tried lensflare before
look the LensFlare.material here:
http://www.ogre3d.org/forums/viewtopic.php?f=11&t=65630
there is material LensFlareHalo , material LensFlareCircle, material LensFlareBurst
but the 3 LensFlare textures are not available, i found it here
https://github.com/petrocket/salvation/ ... s/textures
Thanks!

Yes, this configuration:

Code: Select all

depth_write off
depth_check off
http://radium3dengine.com/img/shot_2014 ... -40-46.jpg
http://radium3dengine.com/img/shot_2014 ... -41-34.jpg

But...
http://radium3dengine.com/img/shot_2014 ... -01-19.jpg

... effect is not hidden if the sun node is not visible under the meshes.

How can I fix it?

Re: CreateLensFlareEffect

Posted: Sat Apr 26, 2014 8:39 am
by applePi
i can reproduce the error in the following example if edited the file PE_materials.material in C:\PureBasic\Examples\3D\Data\OPE\material_scripts\PE_materials.material
like this :

Code: Select all

material PE/lensflare
{
	technique
	{
		pass
		{
			lighting off
			depth_write off
                        depth_check off
			scene_blend add

			texture_unit
			{
				texture flare.png
			}
		}
	}
}
Image

ie :
depth_write off
depth_check off


but change depth_check off to depth_check on
and it works okay

Image

Code: Select all

IncludeFile #PB_Compiler_Home + "Examples/3D/Screen3DRequester.pb"

Define yaw.f, X.f, Y.f, Z.f, FOV.f, Timer.i, eyeMove.f
#LensFlare = 27
#flareMat = 30

If InitEngine3D()
  
  
    Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
    Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts",#PB_3DArchive_FileSystem)
    Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/OPE/material_scripts", #PB_3DArchive_FileSystem)
    Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Packs/desert.zip", #PB_3DArchive_Zip)
    Parse3DScripts()
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  If Screen3DRequester()
    
    ; Ground
    ;
    GetScriptMaterial(0, "Scene/GroundBlend")
    GetScriptMaterial(#flareMat, "PE/lensflare")
        
    CreatePlane(0, 10000, 10000, 100, 100, 50, 50)
    CreateEntity(0, MeshID(0), MaterialID(0))
    
    ; Camera
    ;
    CreateCamera(0, 0, 0, 100, 100)
    MoveCamera(0, 2000, 100, 2000, #PB_Absolute)
    CameraLookAt(0, 0, 1500, 0)
    CameraFOV(0, 60)
    
    ; Node for lensflare
    ;
    CreateNode(0, 0, 500, 0)
    
       
    CreateLensFlareEffect(#Lensflare, CameraID(0), NodeID(0), 10, 100, MaterialID(#flareMat), MaterialID(#flareMat), MaterialID(#flareMat))
   
    CreateCube(3,1000) 
    CreateMaterial(0, LoadTexture(0, "Wood.jpg"))
    CreateEntity(3,MeshID(3), MaterialID(0), 820,700,0)
    
    ; Skybox
    ;
    SkyBox("desert07.jpg")
        
    Repeat
      Screen3DEvents()
                     
            
      If KeyboardPushed(#PB_Key_Left)
        eyeMove+5
        If eyeMove > 30
          LensFlareEffectColor(#LensFlare, #PB_LensFlare_HaloColor , RGB(254,232,180))
        EndIf
      ElseIf KeyboardPushed(#PB_Key_Right)
        eyeMove-5
        If eyeMove < 30
          LensFlareEffectColor(#LensFlare, #PB_LensFlare_HaloColor , RGB(100,232,180))
        EndIf
      EndIf
      
      MoveNode(0, 0, 1000, 0, #PB_Absolute)
      
      ;Camera
      ;FOV = 60 - 30 * Cos(ElapsedMilliseconds() / 2500)
      ;CameraFOV(0, FOV)
      CameraLookAt(0, 1000-eyeMove, 1000, 500)
         
      
      RenderWorld()
      Screen3DStats()
      FlipBuffers()
      
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
    
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf

End

Re: CreateLensFlareEffect

Posted: Sat Apr 26, 2014 6:04 pm
by Lexicon
applePi wrote:ie :
depth_write off
depth_check off


but change depth_check off to depth_check on
and it works okay
Thanks. I'll try it.