Car Lights on the ground

Blitz3D Forums/Blitz3D Programming/Car Lights on the ground

KuRiX(Posted 2006) [#1]
Hi friends. I am trying to add some fake lights to my cars. I have created a plane on the ground, with entityblend 3 and sized correctly to match the vehicle. Then applied a simple white-over-black texture.

Is this a good way?
Where could i find a good light texture? (this is most important, hehe).

Thanks!


KuRiX(Posted 2006) [#2]
This is the Actual Result: (how to make it better?)




Matty(Posted 2006) [#3]
Use a texture which is faded so that the part of the 'light plane/mesh' close to the car is bright and the part which is far from the car is dark.

If you want shadows from any objects in front of the car, within the 'lit area' take a render from the light's perspective, make sure any shadow casting objects are colored black and then apply the resulting render to the texture, perhaps as a second layer multiply blended with the first.


KuRiX(Posted 2006) [#4]
Thanks for your answer Matty. I am not going to make any shadows for that plane/light, because i don't have more fps to spend ;)

If someone had a good light texture for that... I have created that in photoshop with just two ovals...

P.D: Why can i see a line at the end of the plane!?!?! the original bmp does not have it...


Jeppe Nielsen(Posted 2006) [#5]
Using the Clamp UV texture flags might help, 16+32, if I remember correctly.


jfk EO-11110(Posted 2006) [#6]
Suggestion, use a torch (flashlight) in a dark room on a sheet of white paper, then take a picture with a digicam. This way the borders will be blurred realisticly. of course you need to use the same angle as with the car.


IPete2(Posted 2006) [#7]
jfk - what a cool innovative idea... nice one dude!

IPete2.


KuRiX(Posted 2006) [#8]
Great, thanks, but you have given me a great idea. I am going to simulate the torch in 3dsmax, then render, and i get the texture i need!


Vorderman(Posted 2006) [#9]
You could try something like this -


and the two textures used if you want to try them -
http://www.jameskett.dsl.pipex.com/headlight1.tga
http://www.jameskett.dsl.pipex.com/headlight_beam.tga


KuRiX(Posted 2006) [#10]
Hey, great lights! Is it yours?

Thanks for the textures!


KuRiX(Posted 2006) [#11]
How can i force the headlights to be drawn before the car, but not before map, other players, etc???

Edited: Actual Result:




Stevie G(Posted 2006) [#12]
You could use Entityorder but you'd loose z-buffer control so it may look a bit screwed up.

Stevie


KuRiX(Posted 2006) [#13]
Yes, i cannot use entityorder, because then all the headlight would appear in front of buildings, etc...

and if i position the light too far from the car, when it is viewed at more than 45º the result is not good...

Any other ideas?

(anyway thanks for all, the result is acceptable right now)


Beaker(Posted 2006) [#14]
You do a linepick from the light to the camera (or the other way round) and see if anything gets in between. When the light isn't in view you fade it's alpha quickly down to zero, and the reverse when it comes back into view. This gives it a persistance of vision effect, and as a happy by-product means you only have to check one light per frame.


KuRiX(Posted 2006) [#15]
I can't do that. I have 8 cars at the same time, in a city with 30.000 polys. Linepick is too slow. By the moment i am calculating the angle between the car and the camera, and fading the light when the angle is greater than 45º...


KuRiX(Posted 2006) [#16]
Ok, i will use the ray collisions from ODE. Fast and very good!


Damien Sturdy(Posted 2006) [#17]
Kurix, Looking good!

ODE rays are good, I just wish they would be immediate. You have to wait one physics update before they return a hit. :/


KuRiX(Posted 2006) [#18]
That's not true Cygnus! I have wrapped the dCollide function, then you can create the ray in a ZERO space, and call it like:

ODE_dcollide(ray,trimeshspace)

and then:

ODE_dgeomgetcollisioncount(ray)

;)


Damien Sturdy(Posted 2006) [#19]
Whoops, it's my flawed logic. I've got used to having collision and update in a single function. This could come in handy :) the way i used to use ODE, the whole lot of collision checking (some of which was done by blitz) would occur at PhysicsUpdate. :)

*sigh* The guys i'm working with are going to start bashing me aronud the head now! :P

[edit] Our commands are different however i was able to build a similar command set, the above doesn't work for me although it clearly should. My problem is in Blitzmax though so i wont be dirtying up this thread :D


Beaker(Posted 2006) [#20]
Kurix - are you colliding against the actual level mesh (with 30,000 polys)? Wouldn't it be better to use some proxies for collisions (and linepicks)? And/or you could reduce the processing by breaking the level up using a quadtree (or similar).

Are ODE rays faster than linepicks?


KuRiX(Posted 2006) [#21]
I can do 100 rays in ode with less that 2ms, and i only need about 20 rays!

Yes, triangle meshes in ode are really really fast... very much faster that linepicks