Multi Renders and Lights

Blitz3D Forums/Blitz3D Programming/Multi Renders and Lights

Drey(Posted 2004) [#1]
The questions are down below if u don't want to read this crap.


Alil background:
Ok i have few lighting questions. I ideas on how to get them to work but i figure since u guys have been playing around with blitz3d for ages and I, a few months, that u'll probably have decovered something by now.

I know the hardware limitations is 8 max lights. Well, that even wouldn't be a problem if i had more control over them. The problem, u set a light, it becomes global..which is bad. U see, i'm just guess from what i've seen on professional games, that lighting is a function call and probably something that just happens once u set it when u're working directly with DX.

Now there is software lighting, i've tested out many of them and they are all pretty slow. about 1 millisec to light a mesh with 300+ vertices isn't an option. One big reason is that i have about 50,000 polygons on my screen now in my engine( for those who read my first post on here, yes, i'm still working on it :-D). So now i'm working on tryin to get a local lighting system up, where there's probably a global directional light and then local spot and point lights everywere else on actors(not so much the map, that's what light mapping is for..something i'm working on).

So now i'm thinking, hide entity might be an answer, then i reposition the lights and then render the entity. That'll probably work...if it wasn't for render order.

I read from halo's engine that he has multi render system that helps up the FPS. But i think how i'm goin to make sure that when renderworld is called, that This entity might not overlap the entity infront of it. If i create my own Z order system, i figured that would just be to slow and that's the the hardware is for. Now i figured i might just have all other entitys around it become black during the render...then i might be able to use 2d draw commands to the back buffer with transparence on..again tho, now it's rendering extra crap and 2d commands are kinda slow :(


****Questions******
So now how do i make something multirender without worrying about improper Z order?

Is there a decent way around blitz3d's global lighting system( like a function call...maybe someone can make a sweet DX7 DLL with the lighting call in it..:-D )?

Is there a way to make a particular part of a texture uneffected by lighting wihtout using a new surface/mesh to overlay the orginal one effected by light?


JoshK(Posted 2004) [#2]
Yeah, multipass with a unique lighting environment is the way to go for characters, etc.


Drey(Posted 2004) [#3]
Alright, how do u make sure i don't run into improper Z order?


JoshK(Posted 2004) [#4]
Just set CameraClsMode so it doesn't clear the z buffer (after the first pass).


Drey(Posted 2004) [#5]
oh...thank you :-D. U really just helped out alot sir. I thank u for that.


Drey(Posted 2004) [#6]
hey, how's your engine goin anyways?


Uber Lieutenant(Posted 2004) [#7]
Attention everyone, I have bad news. halo's engine's plane crashed down over the English Channel an hour ago...no survivors. They're still looking for the black box. I'm sorry.


JoshK(Posted 2004) [#8]
I use OpenGL and BlitzPlus. It kicks ass. I will crush everyone.


Drey(Posted 2004) [#9]
Only issue i'm having still is the Z buffer order. I turn it off and stuff just gets wild. The lighting idea is working tho, i have 100 ghost lights and 100 meshes. It relocates the light, changes the color and everything. I just can't get the Z order thing down yet.

Halo, how did u get the entitys in the Z buffer if they are all hidden?


Ross C(Posted 2004) [#10]
Remember to reset the cameraclsmode when your doing the very first render, each loop, back it's default settings :)


Drey(Posted 2004) [#11]
i tried that tho, i had renderworld as a Z buffer forcer. Then i set the cameraclsmode to false on color and z buffer.

Basicly kinda like this

Main Loop:
{
CameraclsMode Cam, 0, 1

REnderworld() ;every entity is hidden...the part i
think i'm having issues with. But it's suppost to force
objects into Z buffer...

CameraclsMode Cam, 0,0

Loop each EntityObject

shows ONE entity
Basicly shows needed lights
Positions and Colors lights

Rendeworld()

Hide Lights
Hide Entity
Next entity
}
end of Main Loop

What's wrong exactly?
The lighting is working, just the Z buffer isn't.


Drey(Posted 2004) [#12]
haha, i got it...weird. I thought i tried that before. Thanks for all the help :-D


Wayne(Posted 2004) [#13]
so was the above correct then ?


Drey(Posted 2004) [#14]
Yea, i thought i did that before tho. I program late tho, so sometimes i make stupid errors. It's working tho. I have 100 "lights" and one objects is alot to have 2 lights working on it at once right now. The light max is a variable tho.


MadJack(Posted 2004) [#15]
'I use OpenGL and BlitzPlus. It kicks ass. I will crush everyone. '

Jeez, who's been raiding the steroids cabinet?


Drey(Posted 2004) [#16]
well, i hope he makes soemthing pretty good. I want to see some solid games come out of blitz, not just tech demos. Whatever it takes for him to make something sweet i guess.


Kalisme(Posted 2004) [#17]
this all sounds really interesting... has anyone written a demo to show off this technology? if so... could someone direct me?


Drey(Posted 2004) [#18]
u think i should but it in the code archives?


Kalisme(Posted 2004) [#19]
yes, I think that would be great :) it would be very helpful


Drey(Posted 2004) [#20]
There u go sir

http://blitzbasic.com/codearcs/codearcs.php?code=1246