Need For Speed Style Racing System

Nice to see this milestone. Like very much.

You probably know about this LINK, but for anyone else, here is an EXAMPLE of BABYLON on Code Canyon. Six Helix HTML5 by stelennnn | CodeCanyon
Six Helix by Stelennnn
Doing well, looks like.

Maybe a good place for your Toolkit.

:eagle:

1 Like

Let me know when this is available as well :slight_smile:

1 Like

Check out latest driving mechanics on a Unity Old Vehicle Starter Tutorial Map (Still Some shader issues because the old unity tutorial is still using old and custom legacy shaders… Not PBR… So i have to convert them to the best fit PBR i could for that specific Unity Shader)…

Also the Follow Camera is till a bit choppy… am going to need some community help in creating a Need For Speed Style Smooth Follow Camera… I will put up a skeleton playground with a track and car to follow a bit later.

But for now… here is this demo so far:

http://mackey.cloud/games/racing/demo4

It uses advanced convex sweep testing for each wheel to provide a more solid driving contact surface … Especially on un even, winding twisting road surfaces like this old unity track

3 Likes

This is insane @MackeyK24 !!! you should try to plug in the new cascaded shadow maps !!!

@PirateJC we definitely need this on the website and the 4.1 announcement :slight_smile:


The violence of the physics is awesome. Here I have had a full speed head-on collision with the red racer. I appear to have gotten the better end of it.

1 Like

Very impressive!

This must make its way to our community demo for 4.1 (@PirateJC)

1 Like

The newer demos have better vehicle stability especially high speed contact with other cars

You can now nudge and contact othe cars without flying off in the air

Like Robert Duval said in ‘Rubbin is Racin’

1 Like

This is nuts! @MackeyK24! Super awesome!

I’ve added it to the 4.1 Community Showcase list, as well as the community page:

Yo @sebavan … I am now adding support for Cascade Shadow Generator.

A Couple question about SOFT shadow filters…

its says in docs that the CascadeShadowGenerator support PCF and PCSS filtering… I dont see how to setup PCSS (Which i assume is the Self Shadowing filter).

There is a ‘usePercentageCloserFiltering’ which enables soft shadows but if self shadow it render horrible artifacts… if i use PCF i have to disable receive shadow on self shadow meshes.

So how do i setup to get good SOFT self shadows ???

Thanks for the advice… Cascade Shadows is what Unity uses anyway… So the setup about num cascades can come from Unity Quality Settings… Is there a way to setup my on two and four cascase split info instead of of using the auto splitFrustrum… Unity has a float value for the two cascade split value and a Vector3 of values for the four cascade split… Would be kool to use the exact same cascade split ratios that can be changed in the unity editor… If not… the auto splitFrustrum is working beautifully :slight_smile:

Yo @PirateJC … I am going to make a much better demo than that… Once i do can you change the url you using to: https://www.babylontoolkit.com/projects/speedway

1 Like

Adding @Evgeni_Popov to let him the honor on CSM :slight_smile:

It’s what is called “Contact hardening shadow” in this page: https://doc.babylonjs.com/babylon101/shadows#contact-hardening-shadow-webgl2-only

PCSS is another filtering method, based on PCF, that can display soft shadows, meaning shadows with different darkness depending on the distance from the shadow blocker.

Those artifacts are called “shadow acne” and can be a pain to deal with, whatever the filtering method used.

To limit/remove them:

  • put into the shadow caster list only meshes that can/should actually cast shadows. So, in your case, I think meshes making for the road should not be put in there (maybe there are others). Note that limiting the number of shadow casters also helps for performance.
  • raise the bias / normal bias values until acne disappears.

More generally, see here for ways to deal with shadow rendering artifacts: https://doc.babylonjs.com/babylon101/shadows#troubleshooting

Use the inspector to easily change the values in real time and see what works for you.

If you want, I can also try to help you finding good settings for your shadows (only need a link with the shadow generator setup).

For the time being, there’s not the possibility to manually set breaks, but I think I can add this: waiting for @sebavan or @Deltakosh confirmation.

Regarding Unity: don’t you have also some bias / normal bias / other type of bias settings to tinker with? There’s no shadow mapping technique I know of where you don’t have some kind of bias to adjust, except maybe for SDSM and Dual Depth Layers but both are quite expensive techniques on GPU side (and possibly not doable in current WebGL version).

I do use bias and normal bias of the light setting when exporting shadows… So yes i can tinker with those settings to see if limit/remove artifacts.

So PCSS = Contact Hardening Filter Options

yup PCSS = Percentage-Closer Soft Shadows where PCF = Percentage Closer Filtering.

PCF and PCSS use almost the same soft shadow technique except PCSS accounts accounts for the blocker distance to deduct how soft the shadow should be (it looks better and more natural but is obviously more expensive)

So contact hardening meaning the closer you are for the blocker the less blury the shadow is corresponds to PCSS.

Agree it is a lot of name for the same thing, we should have called them:

  • PCF: Blurry shadows
  • PCSS: Real shadows
1 Like

@MackeyK24 - yup no problem! Just let me know when you’d like it switched over and I can absolutely do that!

Thanks!

So just to clarify… i am setting up toolkit default options.

its has Hard And Soft Shadow Options.

So for Hard shadows… I . set both use percentage close filtering and contact hardening to false…

So for soft shadows with self shadowing options… So i set BOTH USE percentage close and contact hardening to TRUE… or is it either or… LIKE:

Hard Shadows

generator.usePercentageCloseFiltering = false;
generator.useContactHardeningShadow = false;

Soft Shadow (No Self Shadowing)

generator.usePercentageCloseFiltering = true;
generator.useContactHardeningShadow = false;

Soft Shadow (With Self Shadowing)

generator.usePercentageCloseFiltering = true;
generator.useContactHardeningShadow = true;

or

generator.usePercentageCloseFiltering = false;
generator.useContactHardeningShadow = true;

Which is the right way to do self shadowing option ???

both PCF and PCSS can do self shadows.

and both can not be used together last boolean set wins: so either generator.usePercentageCloseFiltering = true;
or
generator.useContactHardeningShadow = true;

for hard shadows, you are right both false.

it seems useContactHardeningShadow really kills the frame rate in demo https://www.babylonjs-playground.com/#IIZ9UU#40