3D Model Lighting Setup - Incorrect?

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

3D Model Lighting Setup - Incorrect?

Post by Xotic750 »

It has been suggested on the development channel on IRC by mitch_cc that the current lighting setup for all 3D modelling is incorrect. If this is the case then all renders to date done using the reference templates found in the wiki are incorrect.

So, what is the correct lighting setup?
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: 3D Model Lighting Setup - Incorrect?

Post by maquinista »

I use some templates downloaded from Wiki.

For vehicles, I adapt the sky because the default sky It creates a dark side. The effect is very sightly, but noticeable when a vehicle reverses.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: 3D Model Lighting Setup - Incorrect?

Post by Xotic750 »

I am using the standard template lighting and I add a little extra light too, but the problem that is being stated is in the following quote:
<michi_cc> Xotic750: Randomly looking at a file (http://dev.openttdcoop.org/projects/ogf ... w/0008.png) I noticed that it uses a wrong/suboptimal light direction. TTD light generally comes from around 5 o'clock, high up, and not 2:30. As can be seen in that file, 2:30 means all visible stuff is dark and thus doesn't look good.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Michi_cc »

And also:
<michi_cc> Whoever decided the standard didn't do a very good job then. I'm making a pure visual argument here, if you have e.g. a house in isometric view, there will always be at least two walls in the shadow and at most two walls lit. Positioning the light source in such a way the lit sides are facing away from the camera just doesn't make sense.
The current template does exactly that, out of the two lit sides, one will always be invisible. This is exactly why vehicles have an unsightly dark side.

-- Michael Lutz
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: 3D Model Lighting Setup - Incorrect?

Post by GeekToo »

Don't blame Chris Sawyer. It helps in determining the shape of the landscape. Dark sides can be lightened by ambient.
http://ipv4.tt-forums.net/viewtopic.php ... 94#p873394 and following posts.
Attachments
Slenfingway Transport, 1st Aug 2133.png
Slenfingway Transport, 1st Aug 2133.png (42.24 KiB) Viewed 5366 times
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: 3D Model Lighting Setup - Incorrect?

Post by Xotic750 »

I have no problem with adding extra material lighting to give greater ambiance to the darker sides and without throwing or altering the current shadow fall. My main concern here, as it states in the original quote;
Michi_cc wrote:TTD light generally comes from around 5 o'clock, high up, and not 2:30.
is that the sun (general lighting and shadow throwing) is positioned incorrectly, and this is what I wish to confirm and correct if necessary.
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Jupix »

Michi_cc wrote:The current template does exactly that, out of the two lit sides, one will always be invisible. This is exactly why vehicles have an unsightly dark side.
What I can gather from what you're saying is that you want is all surfaces visible in the below screenshot to be equally lit by the sun, meaning sun shining from the direction the topmost train is heading?

Image

Can you imagine how bland it would look?


Also, when you (not you personally, everyone in this thread so far) are talking about degrees or o'clocks, make a note of which you're talking about, the template or the gameworld. Because last I opened the Blender template, it opens at 0 degrees, whereas the gameworld is at 45 degrees.


ogfx and 32bpp obey the same lighting directions. Ours is based on the original graphics set and AFAIK so was ogfx. Models have been modeled with the templates for years, successfully. So, wtf is this thread about.
#################
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: 3D Model Lighting Setup - Incorrect?

Post by GeekToo »

Xotic750, maybe I used to few words. With the picture above I wanted to show that the original graphics use a light setup that is close to a 3 o'clock setup (seen from the top view (90 degrees perpendicular to ground tiles, 12 o'clock being in the corner of a tile). With a 5 o'clock setup the SouthEast tile would be the brightest, and NW darkest), and it isn't. And I agree with Jupix that having a setup close to 5 o'clock would make the picture more bland.

Having one of the sides darker, helps the viewer to determine how e.g. a hill, or ridge in a mountain is oriented.

The setup that Ben Robbins uses for the trains: http://www.tt-forums.net/viewtopic.php?p=882270#p882270. Since OTTD only uses 3 o'clock, 4:30, and 6 o'clock orientations, small difference in sun positions would not matter, but changing from 3 and a bit to 5 o'clock would look strange when mixed.

And after all, what is incorrect? If all 32bpp up till now use the current light setup, I guess you can call that the "standard, correct" way.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Michi_cc »

My original comments were about this random image which I was told was rendered using some standard setup: http://dev.openttdcoop.org/projects/ogf ... w/0008.png. It is quite clear from the visible shadow that in this case it results in a sprite where most visible pixels are dark and most invisible pixels would be lit. As highly detailed zoom graphics don't make much sense if nobody can actually see all the details due to them being dark, I am of the opinion that this lighting was a poor choice.
Jupix wrote:What I can gather from what you're saying is that you want is all surfaces visible in the below screenshot to be equally lit by the sun, meaning sun shining from the direction the topmost train is heading?
No, everything lit equally would be light that comes directly from bottom centre. I'm advocating for light somewhere from the bottom right and high up (i.e. how the sun is around noon), which is what a lot of original graphics use. This would mean the left side is still darker than the right (or front in case of the earlier example image), but not totally shadowed.

-- Michael Lutz
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: 3D Model Lighting Setup - Incorrect?

Post by Xotic750 »

The thing is that; the image is not random but is lit using one single template that I have used for all my models, this is the same lighting template as everyone has been using. Putting the image on a background helps to show the main light shadowing.

I agree that the darker (shadowed sides) could use more ambiance but that is something that I can work on by changing material properties and even adding special non-shadow casting material lighting.

I just wanted to be sure that the main light (the sun) is located in the correct position in the sky.
Attachments
GinzuA4.png
GinzuA4.png (78.2 KiB) Viewed 5268 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: 3D Model Lighting Setup - Incorrect?

Post by planetmaker »

I do believe that michi_cc has a very valid point there. And he's certainly not alone with the stance that the sun is around 4:30 ..5:00 pm.

Light direction is one thing which I'd like to get unified within OpenGFX. Unfortunately there has been indeed a lot of confusion whereas the sun really is, thus it's not really homogenuous.

For comparison look at the TTD powerplant. The sun there clearly is past 3 o'clock as the front is lit mor than 50%
Also look at the landscape. The backward slope is much darker than the slope directly facing us. Thus also an indication that the sun is more in the afternoon hours.

I'm very much in favour to use a uniform light direction. And after all it's "only" a re-render to adjust existing sprites after one light template is adjusted - even though I know the computational time it takes.
Attachments
shadow_powerplant.png
shadow_powerplant.png (33.7 KiB) Viewed 5259 times
shadow_landscape.png
shadow_landscape.png (53.4 KiB) Viewed 5259 times
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Jupix »

OK guys. If you think there is a serious problem. Demonstrate with screenshots all the cases where you have an issue. Implement a fix and document it. Post the aforementioned here including screenshots how it fixes the problem. Test with every existing sprite first, of course. Then we can evaluate it for adoption. ;)
#################
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: 3D Model Lighting Setup - Incorrect?

Post by GeekToo »

There really is no real issue.

Michi_cc states the light is coming from behind, and two planes should be lit: he's right about the 2 planes, and that is what the current standard does.
The light comes from a position around or after 3 o'clock like the attached picture shows. The shadows make it look like the light is coming from behind, which is caused by the strange shape, but is a misconception.
This train looks dark at front side, because there is a hole in the back, and it could use some ambient. But look at the front of the train of Ben posted above and judge again.

Planetmaker wants a standard. Well, there is one, it's around for several years and it is one of the few things in 32bpp sprites that *IS* followed.
Attachments
0008_mod.png
0008_mod.png (53.67 KiB) Viewed 5183 times
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: 3D Model Lighting Setup - Incorrect?

Post by Xotic750 »

I've gone to a little effort to show the current standard in a little detail and give a generic model to show how it affects the shading and shadow.
Attachments
Top view showing the sun is at around 16:15, with the reference of 18:00 being the viewer's perspective.
Top view showing the sun is at around 16:15, with the reference of 18:00 being the viewer's perspective.
top.png (5.89 KiB) Viewed 5140 times
Side view showing that the sun is behind the viewer and high in the sky, sunlight strength is controlled by the light strength of the sun lamp and not the actual distance from view point.
Side view showing that the sun is behind the viewer and high in the sky, sunlight strength is controlled by the light strength of the sun lamp and not the actual distance from view point.
side.png (8.28 KiB) Viewed 5140 times
A very bland material that mimics a small hill with a cube on the top. This shows how the shadow is cast from an object and how the shading falls onto angled hillsides.
A very bland material that mimics a small hill with a cube on the top. This shows how the shadow is cast from an object and how the shading falls onto angled hillsides.
standard.png (11.01 KiB) Viewed 5140 times
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Michi_cc »

GeekToo wrote:The light comes from a position around or after 3 o'clock like the attached picture shows.
Not according to the shadow on the ground. See the two red arrows on the left side of the attached image, which use the front and back buffers for reference.

Compare that with the TTD landscaping: There is a dark(er) area and a lit area. From the border between dark and lit you can infer a limits from where the light can come from, these are the two outer red lines on the right part. The light itself is somewhere in the middle. As the two upper faces are brighter than the lower two, light direction is likely somewhat more to the upper red arrow. You have to imagine for yourself that the light is of course not coming parallel to the ground, but from higher up in the sky (can't really paint that easily).

What this completely ignores is that especially the original TTD vehicle graphics aren't shaded exactly after this rule, but instead they are lit by the "whatever looks best" rule, which translates to "put light where the player can see it".

EDIT: standard.png looks quite a lot like the TTD landscape, it just doesn't really match up with the ground shadow of the shown vehicle.

-- Michael Lutz
Attachments
ttd-light.png
ttd-light.png (99.66 KiB) Viewed 5134 times
User avatar
Xotic750
Traffic Manager
Traffic Manager
Posts: 206
Joined: 13 Nov 2011 18:46
Location: Sweden

Re: 3D Model Lighting Setup - Incorrect?

Post by Xotic750 »

The rendered train models use exactly the same template as I used for my example; standard.png

I have to assume that "Blender" is doing its job correctly and calculating the shadow as per the light rays from the light source and affected by the non-transparent materials of the model. Otherwise we are saying that the Blender software is bugged with regard to its light and shadow calculations and I'm not seeing serious users of the product opening any tickets in this respect.

Here is a comparison of my model ( that has been used as an example and rendered using Blender with the blender template), against a model that was created by Ben Robbins (using 3D Studio Max and its equivalent template).

Note: the OpenGFX+ Trains scaling is different to that of the original EZ project.
Attachments
compare_blender_3dsmax.png
compare_blender_3dsmax.png (20.92 KiB) Viewed 5121 times
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: 3D Model Lighting Setup - Incorrect?

Post by GeekToo »

Michi_cc wrote:
GeekToo wrote:The light comes from a position around or after 3 o'clock like the attached picture shows.
Not according to the shadow on the ground. See the two red arrows on the left side of the attached image, which use the front and back buffers for reference.

-- Michael Lutz
Nonsense Michi_cc. The only thing you can conclude from lines in the left picture is that the sun is to the right, and higher than the viewer in the plane from the camera to the object. The sun is at the intersection point, but you can not determine the 3rd dimension from a 2D picture. So you cannot determine this way that the sun is behind the object. The vertical line in my previous post does give that indication: sun in front of the line: line of the light inside the cabin goes up to the left, and that is what it does.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Michi_cc »

GeekToo wrote:So you cannot determine this way that the sun is behind the object.
Please note that my example was purely about the shadow on the ground and not about the inside of the cab. And for that you can of course determine it, that's exactly why I selected the buffers as a distinct feature that is also visible in the shadow. If you imagine yourself to be standing in the engine cab, looking into driving direction, you would see a shadow on the ground that is left of you and parallel to the engine. This means that the (virtual) sun is exactly to the right of the engine. From the buffers, you can determine the elevation, which comes about to something between 45 to 60 degrees above the ground plane.

Translated to a 2D image, this means a light almost exactly in the top right image corner. This is not about the position of any light sources in the blender file but purely how it looks in the rendered image. If I look at the composite image of all rotations, right now there are four views which are mostly dark (the - and \ views). If the light was moved more to the bottom right of the image, only the \ views would remain as mostly dark. The original TTD graphics completely ignore that and have all visible surfaces somewhat lit, going purely by good looks (not having shadows to begin with makes that easier).

-- Michael Lutz
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: 3D Model Lighting Setup - Incorrect?

Post by GeekToo »

I still think the current sun setup is OK, to keep consistency of shadows and lighting with the landscape and buildings.

But there is one thing I completely agree with you: that in most renders of vehicles, the -- and \ left side are much too dark. The light template is a starting point, determining the position of shadows and highlights. But good light setup is complex, and to look good, most vehicles need extra ambient/filler lights/skylights/whatever to hightlight the shadow sides.
That is not included in the lighting template, and maybe it should, but hard to standardize due to different material properties. Maybe some extra explanation on the wiki or so is needed.

An example of how I think it should be filled in, see the engine in the attachment: well lit on all sides, lots of details. It is of course unusable, much too long (another interesting discussion: ratio of height, width and length, not appropriate here though). But an example of how it should be lit in my opinion, without dark blobs without details.

(credits: graphics by Ben Robbins, picture taken from Jupix' repo)
Attachments
brush47.png
brush47.png (1.15 MiB) Viewed 1006 times
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: 3D Model Lighting Setup - Incorrect?

Post by Michi_cc »

GeekToo wrote:An example of how I think it should be filled in, see the engine in the attachment
The wagon in this example also illustrates quite good why I'm of the opinion that a main light source more to the image bottom would result in better looks. When I look at the / view, I see a bright, colourful and generally nice wagon. In both the - and the \ view I see a dull, bland wagon without character (the | view doesn't matter as we don't see the sides there anyway). One of the main features of the original TTD graphics are high contrast and lots of colours resulting in a vivid look. It is of course not possible to have three bright sides while still maintaining consistent shadows, but having at least two bright sides is easily done moving the main light source.

-- Michael Lutz
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Ahrefs [Bot] and 18 guests