MX Bikes Official Forum

Mods => Track Editing => Topic started by: Ruubs on November 12, 2018, 05:18:23 PM

Title: Trying to create a night track with spot lights.
Post by: Ruubs on November 12, 2018, 05:18:23 PM
I'm currently working on a night track with spot lights. The whole track should be dark, except for the areas around the lights. Does anyone have an idea on how to get this effect?

My idea was to create a new texture layer which would be a plain black texture which'll then be the top layer. That'll make the dark spots dark, and I can mask out the areas around the lights. The thing is though, with deformation, that layer will be ridden off. Once a couple of laps are ridden, the whole track would look lit and wouldn't look the way it's supposed to look. Obviously the shadow of the rider won't be right either way. We really need to be able to place more lighting sources so we can make proper night tracks.

This is the idea (image from Mx vs Atv twitter):
(https://pbs.twimg.com/media/Dqdf-V9XgAA8Ej1.jpg:large)

Tell me your ideas, be creative.
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 12, 2018, 05:28:24 PM
I've put a lot of thought into this over the years. You only currently have a few options.

Black fog. You can make it black and dense but that relies on the track being quite small.

Black layer. You can change the thickness so the texture doesn't erode and you can leave the physical thickness low so it deforms  properly. How you get the layers underneath to deform though is beyond me sorry.

You can use that prefix to stop an object from being shaded which is probably useful for light sources.

Not a lot else you can do.
Title: Re: Trying to create a night track with spot lights.
Post by: PizzaChet on November 12, 2018, 06:28:39 PM
This would be awesome and it's important for tracks like Supercross and TNMX where 75% of the racing is under the lights. It looks really good in the MvA shot!  :-[
Title: Re: Trying to create a night track with spot lights.
Post by: Ruubs on November 12, 2018, 06:32:43 PM
Thanks TFC. A few things to try out there.

Lets all get @PiBoSo attention and ask him to add a 'non deformation' parameter for the HMF.
Idea would be that there's one additional parameter in a texture slot, like the mask parameter:
mask = masks/grassmask.tga;
deform = 0;

That way deformation would just 'skip' that layer.

Such a texture can actually be used for more than just a night track.

Does @forumname actually do anything? :-X
Title: Re: Trying to create a night track with spot lights.
Post by: iNsane on November 12, 2018, 06:44:59 PM
Quote from: Sandbiter on November 12, 2018, 06:32:43 PM
Does @forumname actually do anything? :-X

Absolutely not
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 13, 2018, 11:06:30 AM
Quote from: Sandbiter on November 12, 2018, 06:32:43 PM
Thanks TFC. A few things to try out there.

Lets all get @PiBoSo attention and ask him to add a 'non deformation' parameter for the HMF.
Idea would be that there's one additional parameter in a texture slot, like the mask parameter:
mask = masks/grassmask.tga;
deform = 0;

That way deformation would just 'skip' that layer.

Such a texture can actually be used for more than just a night track.

Does @forumname actually do anything? :-X

Sounds good to me.
Title: Re: Trying to create a night track with spot lights.
Post by: Asdrael on November 13, 2018, 12:55:16 PM
Have you tried putting a solid box around your map and the main light source outside of it? To see if the track is then black or not.

I know you can only have one light source, but maybe by creating a box around the track with holes in it to let the light go through you'd achieve the same effect.
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 13, 2018, 01:30:45 PM
Quote from: Asdrael on November 13, 2018, 12:55:16 PM
Have you tried putting a solid box around your map and the main light source outside of it? To see if the track is then black or not.

I know you can only have one light source, but maybe by creating a box around the track with holes in it to let the light go through you'd achieve the same effect.

That's thinking outside the box  ;D

That mixed with black fog could work well..
Title: Re: Trying to create a night track with spot lights.
Post by: Ruubs on November 13, 2018, 03:04:29 PM
Quote from: тғc on November 13, 2018, 01:30:45 PM
Quote from: Asdrael on November 13, 2018, 12:55:16 PM
Have you tried putting a solid box around your map and the main light source outside of it? To see if the track is then black or not.

I know you can only have one light source, but maybe by creating a box around the track with holes in it to let the light go through you'd achieve the same effect.

That's thinking outside the box  ;D

That mixed with black fog could work well..

I gotta try that. Great idea Asdrael.

Am I correct that the lightsource always points at the middle of the track? I know you can set the light source position, but where does it point towards?
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 13, 2018, 03:10:45 PM
It has to be middle. I'd go for directly above if trying this
Title: Re: Trying to create a night track with spot lights.
Post by: Ruubs on November 13, 2018, 03:45:50 PM
Quote from: тғc on November 13, 2018, 03:10:45 PM
It has to be middle. I'd go for directly above if trying this
That's what I thought. Thanks for clarifying!
Title: Re: Trying to create a night track with spot lights.
Post by: Asdrael on November 13, 2018, 03:55:28 PM
Since you define the light source position, it might be a point source. It that case it doesn't point toward anything, just toward... everything. Easy way to try: 3 poles on the middle of the track, light source at the edge of the heightmap at ground level, see if the pole shadows are parallel.

Also, don't forget that you need to define the light source for the "rider" (the amb in the track folder) and for track creation (during the THT compilation step iirc).
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 13, 2018, 05:31:38 PM
Quote from: Asdrael on November 13, 2018, 03:55:28 PM
Since you define the light source position, it might be a point source. It that case it doesn't point toward anything, just toward... everything. Easy way to try: 3 poles on the middle of the track, light source at the edge of the heightmap at ground level, see if the pole shadows are parallel.

Also, don't forget that you need to define the light source for the "rider" (the amb in the track folder) and for track creation (during the THT compilation step iirc).

You're right. There's no perspective. 3 poles with the light source above will probably give no shadows. Is orthographic the right word?
Title: Re: Trying to create a night track with spot lights.
Post by: PizzaChet on November 14, 2018, 06:29:31 PM
Definition of orthographic
1 : of, relating to, being, or prepared by orthographic projection
an orthographic map
2a : of or relating to orthography
b : correct in spelling


or·thog·o·nal
/ôrˈTHäɡənl/Submit
adjective
adjective: orthogonal
1.
of or involving right angles; at right angles.
2.
STATISTICS
(of variates) statistically independent.
(of an experiment) having variates that can be treated as statistically independent.
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 14, 2018, 07:15:27 PM
Quote from: PizzaChet on November 14, 2018, 06:29:31 PM
Definition of orthographic
1 : of, relating to, being, or prepared by orthographic projection
an orthographic map
2a : of or relating to orthography
b : correct in spelling


or·thog·o·nal
/ôrˈTHäɡənl/Submit
adjective
adjective: orthogonal
1.
of or involving right angles; at right angles.
2.
STATISTICS
(of variates) statistically independent.
(of an experiment) having variates that can be treated as statistically independent.


Yes so like..

(http://db-in.com/images/projection_example.gif)
Title: Re: Trying to create a night track with spot lights.
Post by: PiBoSo on November 14, 2018, 11:55:29 PM
Quote from: Asdrael on November 13, 2018, 12:55:16 PM
Have you tried putting a solid box around your map and the main light source outside of it? To see if the track is then black or not.

I know you can only have one light source, but maybe by creating a box around the track with holes in it to let the light go through you'd achieve the same effect.

This is a very clever idea!
Using a vertical light direction ( 0,1,0 ) and a quad facing down, hovering over the entire terrain, should do the trick.

Nonetheless, if you have patience to wait, please note that support for night lighting is already halfway in progress and will completed as soon as possible.
Title: Re: Trying to create a night track with spot lights.
Post by: Asdrael on November 15, 2018, 12:45:08 PM
Quote from: PiBoSo on November 14, 2018, 11:55:29 PMThis is a very clever idea!
I know, I know ;)

QuoteUsing a vertical light direction ( 0,1,0 ) and a quad facing down, hovering over the entire terrain, should do the trick.
The question then is: if you have no perspective, the light beams will be always be parallel / cubic rectangle shape since if I now understand correctly you define the light direction, meaning you estimate the light source at an infinite distance. Which doesn't stand for stadium lights. Does the game handle ambiant light reflection? Otherwise it will be pitch black / light / pitch black / light. Or is that taken care of by the 2 different light (when compiling and then in track folder)?
Title: Re: Trying to create a night track with spot lights.
Post by: Corrie on November 16, 2018, 04:28:35 AM
Hey Asdrael, I am also working on integration of night tracks while the finishing touches of multiple light sources is added. Doing your idea, I ended up with this result:

(https://i.imgur.com/78t2nd5.jpg)

It's really odd, and doesn't seem to work very well (I realize I should change the skybox, etc. but it was a first attempt). Let me know what you think.
Title: Re: Trying to create a night track with spot lights.
Post by: Asdrael on November 16, 2018, 10:15:04 AM
That's not odd at all, it works exactly as suspected. You are using 0,1,0 I suppose?

The light goes in a straight line. Parallel lines. So you end up with a projection of your shape onto your heightmap. And with 0,1,0 it's just a vertical projection.

What will look better is something like 1,1,0 so it has an angle, and bigger holes in the ceiling. But you will still end up with the effect of targeted holy beams of light whatever you do, and that won't change until we can define light "cones" and "point sources" and not just vectors.

That's basically what you are coding in game right now, so yes it looks as expected:
(http://www.coloradopics.com/watermark.php?i=11643)

I'm curious how it looks like in game with the second light from .amb, and not just in map viewer though. And WTB Independance Day track
(http://www.nanarland.com/Chroniques/independenceday/independenceday1.jpg)
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 16, 2018, 12:16:56 PM
Going to have a crack at this later, think I have a good solution. But, what was the prefix for self emmision lighting in Blender?
Title: Re: Trying to create a night track with spot lights.
Post by: iNsane on November 16, 2018, 12:28:16 PM
Wouldn't it work if we're doing circles around the holes with different transparencies? From 100-0, does something below 100 and higher than 0 change in how dark the shadow gets? I mean, fences as planes are working too, when creating a .tga with transparency.

Gonna give it a go later too, this starts going places :D
Title: Re: Trying to create a night track with spot lights.
Post by: 𝖙𝖋𝖈 on November 16, 2018, 12:45:53 PM
Quote from: iNsane on November 16, 2018, 12:28:16 PM
Wouldn't it work if we're doing circles around the holes with different transparencies? From 100-0, does something below 100 and higher than 0 change in how dark the shadow gets? I mean, fences as planes are working too, when creating a .tga with transparency.

Gonna give it a go later too, this starts going places :D

That was partly what I'm thinking. Faded holes placed wherever you want the light to land.
Title: Re: Trying to create a night track with spot lights.
Post by: Corrie on November 16, 2018, 05:53:49 PM
That picture is in-game. I'll keep working on it tonight, with an alpha layer to spread the light out.
Title: Re: Trying to create a night track with spot lights.
Post by: Ruubs on November 18, 2018, 10:11:30 AM
Quote from: PiBoSo on November 14, 2018, 11:55:29 PM
Quote from: Asdrael on November 13, 2018, 12:55:16 PM
Have you tried putting a solid box around your map and the main light source outside of it? To see if the track is then black or not.

I know you can only have one light source, but maybe by creating a box around the track with holes in it to let the light go through you'd achieve the same effect.

This is a very clever idea!
Using a vertical light direction ( 0,1,0 ) and a quad facing down, hovering over the entire terrain, should do the trick.

Nonetheless, if you have patience to wait, please note that support for night lighting is already halfway in progress and will completed as soon as possible.
Sounds good, thanks for letting us know.

Is there still any change for the parameter I described in my original post? I have quite a few ideas which it'll be useful for.