Shadow!!
Blitz3D Forums/Blitz3D Programming/Shadow!!
| ||
![]() The only way I find to learn is trial and error, is my only way of understanding things because my native language translators not help me much. I can say with certainty that I am glad to understand how to make shadows blitz3d without external libs, and sometimes I do not think there is any difference with Fastext. Well the fact is that I need to tell me how to remove the box of the camera and the camera that displays projected shadow. A greeting. |
| ||
1. hide view camera, render shadow camera 2. copy screen to texture 3. hide shadow camera, render view camera 4. Flip |
| ||
=) thank Graphics3D 800,600,32,0 SetBuffer BackBuffer() Global Xscale#=1*(.8/3) Global Sombra = CreateTexture(256,256,16+32) ;=============================== AmbientLight 64,64,64 Global Camara = CreateCamera() Global Terreno = CreateCube() Global Sol = CreateLight() PositionEntity Camara, 0,6,-12 ScaleEntity Terreno, 50,1,50 RotateEntity Sol, 90,0,0 Global Cubo = CreateCube() PositionEntity Cubo,0,4,0 EntityColor Cubo,255,0,0 ;================================== Global S_Camara = CreateCamera() CameraViewport S_Camara,0,0,256,256 CameraProjMode S_Camara,2 CameraZoom S_Camara,.3 PositionEntity S_Camara,0,200,0 HideEntity S_Camara EntityTexture Terreno,Sombra Repeat TurnEntity Cubo,1,.1,0 PointEntity S_Camara,Cubo Actualizar() RenderWorld Text 0,0,TrisRendered() Flip Until KeyHit(1) End Function Actualizar() SetBuffer TextureBuffer( Sombra) Color 255,255,255 Rect 0,0,TextureWidth(Sombra)+1,TextureHeight(Sombra)+1 SetBuffer BackBuffer() ShowEntity S_Camara HideEntity Camara EntityColor Cubo,64,64,64 EntityFX Cubo,1+8 RenderWorld() CopyRect 0,0,256,256,0,0,BackBuffer(),TextureBuffer(Sombra) EntityColor Cubo,255,0,0 EntityFX Cubo,0 For s=1 To CountSurfaces(Terreno) surf=GetSurface(Terreno,s) For v=0 To CountVertices(surf)-1 TFormPoint VertexX(surf,v),VertexY(surf,v),VertexZ(surf,v),Terreno,S_Camara VertexTexCoords surf,v,(TFormedX()/Xscale#)/32+0.5,1-((TFormedY()/Xscale#)/32+.5) Next Next HideEntity S_Camara ShowEntity Camara End Function Last edited 2011 |