Is this the end of Devil Shadow system?

Blitz3D Forums/Blitz3D Userlibs/Is this the end of Devil Shadow system?

Dicon(Posted 2010) [#1]
I downloaded the zipped pack and am trying to understand it. The creator has stopped working on it and the forum was closed because of attacks by spammers. Which is sad.
I can nearly get it to work for me, but without a support, there is no future use for me in it.
So.............
Is there any system that is simple to understand that can give me shadows for an architectural townscape in Blitz3d please.
I find the Swift System a bit beyond me ( sad but that's me ) so any live, devloping system and a lively and helpful forum would be a great help.
Thanks
Dicon


Rroff(Posted 2010) [#2]
The only one (other than swifts) that is actively supported is fastext - and its probably a little tricky to use for your intended type of useage. Tho basic implementation is very easy and it works well with clever use - it lacks self shadowing, PSSM, bleeds through z-buffer and hence doesn't work too well from certain angles or for complex/internal geometry.

DSS has some issues which IMO are probably enough to avoid using it tho it has some nice features and is the most complete/performing realtime shadow system available for blitz:

Breaks some aspects of multi texturing
Compatibility issues with some setups
Potential performance trade offs
Potential overlap with patents owned by creative and idsoftware that may prevent its fully legal useage in commercial developements and may have implications for shareware and even public domain releases.


Dicon(Posted 2010) [#3]
Thanks for the speedy response, but am unclear what DSS is.
I did Google and try to find it but could not.
I would be very happy for a simple shadow and bump map package. I do use Gile[s] but it's a hassle loading, exporting, correcting, etc.

I thought DSS was the "Department for Social Security"...
< thinks >
Probably not. 8¬)

Thanks
Dicon


Dicon(Posted 2010) [#4]
Dhu!
I figured it out. Devil shadow system.
My only excuse is lack of coffee.
It's too early,

Thanks

Dicon


Rroff(Posted 2010) [#5]
FastExt has environment bump mapping thats simple to use and very versatile, for normal maps it does support it similiar to the limited dot3 version in B3D but its a bit more complicated to setup (textureblendcustom image,D3DTOP_DOTPRODUCT3).


puki(Posted 2010) [#6]
The trick with Blitz3D is to real-time process the dot3, not just apply it and forget it, which is what a lot of people do with Dot3.

This is all about going deep into the meshes and using the likes of TFormPoint Vertex... and TFormNormal. Of course, you have to constantly call this when you want the effect to be seen as you have to real-time calc the light position to the mesh.

When done correctly, you can sit back and watch Blitz3D mimic id Tech 4.


I have nothing but praise for DSS and the other engines as they were free for the community and some people seemed to target them for some reason or other. Personally, I'd like to see a bit of revenge.


Rroff(Posted 2010) [#7]
yeah I noticed entity R,G,B color values adjusted the normals and luminance with the D3D OP DOT3 but couldn't work out how to make use of it for anything useful on the fly. I remember someone posted a sample on here for how to update the built in dot3 blend in realtime but couldn't find that either :S


puki(Posted 2010) [#8]
Yeh, the final part of the process would be via VertexColor surface,v,R,G,B for me.

"Fredborg" would have done it this way:
Function UpdateBumpNormals(mesh,light,lighttype=0)

	n_surf = CountSurfaces(mesh)
	For s = 1 To n_surf
		surf = GetSurface(mesh,s)
		n_vert = CountVertices(surf)-1
		For v = 0 To n_vert
			red2# = 0.0
			grn2# = 0.0
			blu2# = 0.0	
			For d3l.Dot3Light = Each Dot3Light
				If d3l\typ = 1 ; Directional light
					TFormVector 0,0,1,d3l\ent,0
					nx# = TFormedX()
					ny# = TFormedY()
					nz# = TFormedZ()
					TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0
					red# = TFormedX()
					grn# = TFormedY()
					blu# = TFormedZ()
				ElseIf d3l\typ = 2 ; Point light
					TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0
					nx# = -TFormedX()
					ny# = -TFormedY()
					nz# = -TFormedZ()
					TFormPoint VertexX(surf,v),VertexY(surf,v),VertexZ(surf,v),mesh,0
					red# = TFormedX()-EntityX(d3l\ent,True)
					grn# = TFormedY()-EntityY(d3l\ent,True)
					blu# = TFormedZ()-EntityZ(d3l\ent,True)
					d# = Sqr(red*red + grn*grn + blu*blu)
					red = red/d
					grn = grn/d
					blu = blu/d
				Else
					RuntimeError "Do it yourself, will ya?"
				End If

				dot# = (red*nx + grn*ny + blu*nz)
				If dot<0.0 Then dot = 0.0	

				red# = ((1.0+(red*dot))*127.5)*d3l\mul
				grn# = ((1.0+(grn*dot))*127.5)*d3l\mul
				blu# = ((1.0+(blu*dot))*127.5)*d3l\mul
				If red<0 Then red = 0
				If grn<0 Then grn = 0
				If blu<0 Then blu = 0				
				red2# = red2+red
				grn2# = grn2+grn
				blu2# = blu2+blu	
			Next
			
			VertexColor surf,v,red2,grn2,blu2
		Next
	Next

End Function

Function Dot3_CreateLight(typ=1,parent=0,real=True)
	
	d3l.Dot3Light = New Dot3Light
	
	If real
		d3l\ent = CreateLight(typ,parent)
	Else
		d3l\ent = CreatePivot(parent)
	End If

	d3l\typ = typ
	d3l\mul = 1.0
	
	Return d3l\ent

End Function

Function Dot3_LightRange(ent,range#)

	For d3l.dot3light = Each dot3light
		If d3l\ent = ent
			If Lower$(EntityClass(d3l\ent))="light"
				LightRange d3l\ent,range
				Return
			End If
		End If
	Next
	
End Function

Function Dot3_LightIntensity(ent,intens#)
	For d3l.dot3light = Each dot3light
		If d3l\ent = ent
			d3l\mul = intens
			If Lower$(EntityClass(d3l\ent))="light"
				LightColor d3l\ent,d3l\mul*255.0,d3l\mul*255.0,d3l\mul*255.0
			End If			
			Return
		End If
	Next
End Function


End



I go for a modified version of this - it is probably "fredborg's" as well:
Function UpdateBumpNormals(mesh,light,lighttype=0)
	EP=GetParent(mesh)
	If EP	EntityParent mesh,0,1

	n_surf = CountSurfaces(mesh)
	For s = 1 To n_surf
		surf = GetSurface(mesh,s)
		n_vert = CountVertices(surf)-1
		For v = 0 To n_vert
			red2# = 0
			grn2# = 0
			blu2# = 0
			For d3l.Dot3Light = Each Dot3Light
				lx#=EntityX(d3l\ent,True)
				ly#=EntityY(d3l\ent,True)
				lz#=EntityZ(d3l\ent,True)
	
				If d3l\typ = 1 ; Directional light
					TFormVector 0,0,1,d3l\ent,0
					nx# = TFormedX()
					ny# = TFormedY()
					nz# = TFormedZ()
					TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0
					red# = TFormedX()
					grn# = TFormedY()
					blu# = TFormedZ()
					
					
				ElseIf d3l\typ = 2 ; Point light		
					; Vertex Normal in World coordinates
					TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0
					Vnx# = TFormedX()
					Vny# = TFormedY()
					Vnz# = TFormedZ()
					
					; Vertex > Light Vector in World coordinates
					TFormPoint VertexX(surf,v),VertexY(surf,v),VertexZ(surf,v),mesh,0
					Lvx# = lx - TFormedX()
					Lvy# = ly - TFormedY()
					Lvz# = lz - TFormedZ()

					; Normalize Vertex > Light Vector
					d# = Sqr(Lvx*Lvx + Lvy*Lvy + Lvz*Lvz)
					Lvx	=	Lvx / d
					Lvy = Lvy / d
					Lvz = Lvz / d
				End If

				; Theta Angle between Vertex Normal & Vertex>Light Normal
				dot# = (Lvx*Vnx + Lvy*Vny + Lvz*Vnz)

				; Clamp Colors to 0
				If dot<0.0 Then dot# = 0
				
				; If the Mesh had a Parent, Convert Light Vector into that Parents Local coordinates
				; unsure if this'll work with multiple hierarchy
				If EP
					TFormNormal Lvx,Lvy,Lvz,0,EP
					Lvx# = TFormedX()
					Lvy# = TFormedY()
					Lvz# = TFormedZ()
				End If
				
				red# = ( (1.0+( Lvx * dot)) * 127) * d3l\mul
				grn# = ( (1.0+( Lvy * dot)) * 127) * d3l\mul
				blu# = ( (1.0+( -Lvz * dot)) * 127) * d3l\mul
				
				red2# = red2+red
				grn2# = grn2+grn
				blu2# = blu2+blu
			Next
			VertexColor surf,v,red2,grn2,blu2
		Next
	Next
	If EP EntityParent mesh,EP,1
End Function





Function Dot3_CreateLight(typ=1,parent=0,mul#=1.0,real=True)
	
	d3l.Dot3Light = New Dot3Light
	
	If real
		d3l\ent = CreateLight(typ,parent)
		LightRange d3l\ent,50
	Else
		d3l\ent = CreatePivot(parent)
	End If

	d3l\typ = typ
	d3l\mul = mul
	
	Return d3l\ent

End Function

Function Dot3_LightRange(ent,range#)
	For d3l.dot3light = Each dot3light
		If d3l\ent = ent
			If Lower$(EntityClass(d3l\ent))="light"
				LightRange d3l\ent,range
				Return
			End If
		End If
	Next
	
End Function

Function Dot3_LightIntensity(ent,intens#)
	For d3l.dot3light = Each dot3light
		If d3l\ent = ent
			d3l\mul = intens
			If Lower$(EntityClass(d3l\ent))="light"
				LightColor d3l\ent,d3l\mul*255.0,d3l\mul*255.0,d3l\mul*255.0
			End If			
			Return
		End If
	Next
End Function


End


So, it is calling (each loop(if you want)):
For d3l.dot3light = Each dot3light
PositionEntity d3l\ent,Float((MouseX()-400))/200,-Float((MouseY()-300))/200,0,0 - or wherever your light is.
Next

and then jumping into the functions with UpdateBumpNormals(MeshEntity,light,1)


puki(Posted 2010) [#9]
Alternatively:
Function entityLight(entity)
	For d3l.Dot3Light = Each Dot3Light
		ox#=EntityX(d3l\ent)
		oy#=EntityY(d3l\ent)
		oz#=EntityZ(d3l\ent)
		TFormPoint ox,oy,oz,d3l\ent,entity
		PositionEntity d3l\ent,TFormedX(),TFormedY(),TFormedZ() ;Transpose light into 
		dx# =EntityX(d3l\ent)-EntityX( entity)
		dy# =EntityY(d3l\ent)-EntityY( entity)
		dz# =EntityZ(d3l\ent)-EntityZ( entity)
		nl#=Sqr(dx*dx+dy*dy+dz*dz)
		nx#=dx/nl
		ny#=dy/nl
		nz#=dz/nl
		nl=(255-nl)/255.0
		nl=1-nl
		If nl>1 nl=1
		If nl<0 nl=0
		nx=nx*nl
		ny=ny*nl
		nz=nz*nl
		EntityColor entity,128+(128*nx),128+(128*nz),128+(128*ny)
		PositionEntity d3l\ent,ox,oy,oz ;return light.
	Next
End Function



Function UpdateBumpNormals(cube)
	n_surf = CountSurfaces(cube)
	For s = 1 To n_surf
		surf = GetSurface(cube,s)
		n_vert = CountVertices(surf)-1
		For v = 0 To n_vert
			red2# = 0.0
			grn2# = 0.0
			blu2# = 0.0	
			For d3l.Dot3Light = Each Dot3Light
				ox#=EntityX(d3l\ent)
				oy#=EntityY(d3l\ent)
				oz#=EntityZ(d3l\ent)
				If d3l\typ = 1 ; Directional light
					TFormVector 0,0,1,d3l\ent,0
					nx# = TFormedX()
					ny# = TFormedY()
					nz# = TFormedZ()
					TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0
					red# = TFormedX()
					grn# = TFormedY()
					blu# = TFormedZ()
				ElseIf d3l\typ = 2 ; Point light
					TFormNormal VertexNX(surf,v),VertexNY(surf,v),VertexNZ(surf,v),mesh,0
					nx# = -TFormedX()
					ny# = -TFormedY()
					nz# = -TFormedZ()
					TFormPoint VertexX(surf,v),VertexY(surf,v),VertexZ(surf,v),mesh,0
					;PositionEntity d3l\ent,TFormedX(),TFormedY(),TFormedZ() ;Transpose light into
					red# = TFormedX()-EntityX(d3l\ent,True)
					grn# = TFormedY()-EntityY(d3l\ent,True)
					blu# = TFormedZ()-EntityZ(d3l\ent,True)
					d# = Sqr(red*red + grn*grn + blu*blu)
					red = red/d
					grn = grn/d
					blu = blu/d
				Else
					RuntimeError "Do it yourself, will ya?"
				End If

				dot# = (red*nx + grn*ny + blu*nz)
				If dot<0.0 Then dot = 0.0
				
				If dot>1.0 Then dot = 1.0
				red# = ((1.0+(red*dot))*127.5)*d3l\mul
				grn# = ((1.0+(grn*dot))*127.5)*d3l\mul
				blu# = ((1.0+(blu*dot))*127.5)*d3l\mul
				If red<0 Then red = 0
				If grn<0 Then grn = 0
				If blu<0 Then blu = 0				
				red2# = red2+red
				grn2# = grn2+grn
				blu2# = blu2+blu	
				PositionEntity d3l\ent,ox,oy,oz ;return light.
			Next
			VertexColor surf,v,red2,grn2,blu2
		Next
	Next
End Function

Function Dot3_CreateLight(typ=1,parent=0,real=True)
	
	d3l.Dot3Light = New Dot3Light
	
	If real
		d3l\ent = CreateLight(typ,parent)
	Else
		d3l\ent = CreatePivot(parent)
	End If

	d3l\typ = typ
	d3l\mul = 1.0
	
	Return d3l\ent

End Function

Function Dot3_LightRange(ent,range#)

	For d3l.dot3light = Each dot3light
		If d3l\ent = ent
			If Lower$(EntityClass(d3l\ent))="light"
				LightRange d3l\ent,range
				Return
			End If
		End If
	Next



Rroff(Posted 2010) [#10]
nice one - I'll have to have a browse of this.


bytecode77(Posted 2010) [#11]
The devil engines are not beeing developed, but hosted there as they always were. i'm also happy to answer any questions.

the big news: i'm working on "Devil-Engines SDK". therefore, i'm using Blitz3D SDK. I already implemented stencil shadows, tokamaks and particles.

look:


i will not announce any release dates or any specific information yet.
the only thing i can say is, that it is for C# and it is as easy as riding a bike!


ShadowTurtle(Posted 2010) [#12]
i see the "Devil-Engines SDK" does support graphic buffers?

Ok.. when "Devil-Engines SDK" is laterly based on the leadwerks engine (or ogre3D), will be the graphics buffer commands supported too?


bytecode77(Posted 2010) [#13]
Devil-Engines SDK is NOT based on leadwerks nor it uses any features.

it is based upon the Blitz3D SDK. It will support everything what b3dsdk does plus shadows, physics, particles and sound.
yet it is not finished and i can't promise anything yet.
and yes, it supports the blitz graphics commands. the engine is more like the managed way you used to know from .NET coding.

i also don't know how many are interested in it. are there many coding with c# + b3dsdk here?


ShadowTurtle(Posted 2010) [#14]
Please make no indirect question about using C#..

Personaly i prever the old c++ style way because there are many alg. here and you can use fast asm snippets without hassle or needed asm-sim on some chips. I hope you make a way to use latery asm code injection for speed ups :)

On the other side today you need asm only for realy AI/Physic/Graphic-Powering. In this way c# is good for casual games but not more.

Irrlicht 3D and ogre3d has not seen good days with C#. I do mean real rewritten code in C# but nothing some dll wrapper..

You should support at least C# because it is the future of the market.


bytecode77(Posted 2010) [#15]
yes, i'm supporting C# and not C++. as a matter of fact, i'm not programming the SDK for every language, but rather for one.

i still have some problems with it. the performance seems lower than the one i ex2perienced with BB and the sound system is still indevelopment. i'll let you all hear from me when it's time for any sort of releases...

here is another screenshot as appetizer:



ShadowTurtle(Posted 2010) [#16]
You should find the slowest function. Probably you make wrong use of the gpu.

It can be one of the "use vertexbuffer instead display-lists" problem :)