Lighting Question

Posted By: Garrettwademan

Lighting Question - 12/01/18 19:33

So I have been beating my head over this, can anyone tell me why my light cast is acting this way on the models? The ceiling tile and floor is 1 model, but it has multiple faces and the light appears different at each face having its own local light scheme. Looking to see if I can make this look more realistic. Any thoughts?

FYI - I have almost no code to handle this today, so I am open to ideas on how to start on this.

Posted By: 3run

Re: Lighting Question - 12/01/18 19:53

Hi there! I guess only per pixel lighting will fix this issue. By default acknex uses vertex lightning as far as I know. So the best way to fix that, is to use shaders (to write it by yourself, cause I can't really recall a 'ready-to-use' solution for that Edit: I guess those bumpmapping shaders from AUM or free resource page are having per pixel lightning).

Edit: also, face-separation might help. I remember something about this from Superku, will try to find now.

Edit2: I couldn't find it.. so here I've made some screen shots to show what I meant by face-separation:
1 - this is a simple 'smooth' box created in MED, it will have some lightning issues (same as on your screenshot).
2 - select one of it's sides (f.e. the top as on this picture) and press COPY (near by the OPEN, SAVE etc)
3 - after copying it, remove the side (press delete)
4 - press PASTE button which is right next to COPY, and you'll get separated top side of the box
5 - continue with the rest 5 sides, and you'll get a box with separated faces

This will help to get more or less proper lightning, but per pixel lightning shader is MUST have too (combined with this tips).
Quote:
#1

#2

#3

#4

#5



Edit3: also, you can see differences between vertex lightning (only looks good on more or less high polygon models/surfaces) and per pixel lightning on this videos
Vertex Lighting
BDX Devlog #2 - Per-Pixel Lighting

Best regards.
Posted By: Garrettwademan

Re: Lighting Question - 12/01/18 20:14

You guys got it! Thanks.

Posted By: 3run

Re: Lighting Question - 12/01/18 20:17

Glad to be helpful! Thanks to Superku, I've learned all those awesome tips from him! laugh
Posted By: Superku

Re: Lighting Question - 12/02/18 07:22

@3run: Good avice/ post! wink
My pic you were probably looking for - from January 2013, took me a while to find it:

Posted By: 20BN

Re: Lighting Question - 12/03/18 16:25

You can import *.obj in "Model from FBX 2010" fix all smooth group.
Posted By: Garrettwademan

Re: Lighting Question - 01/04/19 03:33

I see what you did, you basically have a model that has welded vertices connecting more than 1 plane facing different directions etc, and you copied the specific faces, and re pasted so its on its own group, and then delete the original, thus removing the shared vertices....right? BRILLIANT. I think you now taught me what the heck has been going on with my models over the years lol.

I have focused my entire career to coding and getting a game to a functional point...now that I am here I am learning so much about the finishing touches. I still need to learn shaders and special edge blending lol.

This is probably way off topic, but if anyone has tried this, it would be you Superku. Is there a way to make like a light outline around a certain model? Say for instance in your model above, if you wanted to have a red outline around the model outside edges, does this game engine support such a thing?
Posted By: Garrettwademan

Re: Lighting Question - 01/04/19 04:46

So I spent the last hour following your steps on some of my main models....and WOWZER! Amazing overhaul to my output with so little work. FYI Tonight I learned to link the keyboard hotkeys in MED haha, I had no idea this worked in the A8 MED, been using a very old MED I just found out too.

Check this out, THANK YOU AGAIN!!

Posted By: Superku

Re: Lighting Question - 01/04/19 14:00

Np, glad it's helping you out!
Outline: Fullscreen outlines for all geometry via postprocessing is rather easy, might work for a single object as well (via a mask/ MRTs). The easiest way would be to create a duplicate of your model but where you weld all close-by vertices (again), then create a shader where you offset all vertices by the vertex normal direction times some factor. (You can do this in let's say Blender as well, scale in normal direction, but via shader you could let's say animate it slightly or change the offset based on the distance to the camera.)

Btw. you should start looking into some shaders for reflective materials, for a semi shiny reflective floor, for dynamic highlights on metal and all that good stuff. I'm not necessarily talking about actual real time reflections but you could try that as well.
I use shaders for everything and most of the time sample a simple highlight texture based on the view transformed normals, which makes objects look more dynamic and not as pre 1999. I use that for example for subtle highlights on characters or to give a flat greyscale object a metallic look of sorts.
Regarding reflective materials, here's something I made and recorded a few weeks ago (first 10seconds or so): https://i.gyazo.com/6443ca1228cb2d7571e5dd960973ae3b.mp4
It's over the top of course but shows how basic textures can be transformed into something else not via artistic skills but some coding.
Posted By: Garrettwademan

Re: Lighting Question - 01/05/19 00:38

That is really good advice. I got as close as considering duplicating my model and always having it slightly bigger behind the original and make it like an all in 1 color, but it would have to move around the camera and I think I have too many items to handle for this. That is okay but wanted to make sure it wasn't something super easy.

As for my shaders, I use 0 now (I use 1 to make an item all white lol). I will watch your video because I think having some fake reflections could do a lot of good, along with some object shaders. I know it can be done, I just have to focus on it. I will go back and do some reading on the tutorials as well. Now that the main code is done in my project, I can now begin to look at this stuff. My thought before hand was if I have no code, there is no point to having good models. I can't say that now.

I know this forum has some good stuff too, I plan on going through it for final touches.
Posted By: Garrettwademan

Re: Lighting Question - 01/05/19 02:07

Okay so I watched your over the top demo of your shaders and now I am shaking with excitement literally, like my mind is racing on what I just saw. Okay so question, I am using C-Script, what am I limited to on the shaders I just saw? I feel like since I am using C-Script and now Lite-C I am limited.

Second question, how in the heck did you learn how to do those shaders? Do you have a learning source so I can look into this and start getting into trouble?

You have just boggled my mind by the way.
Posted By: Superku

Re: Lighting Question - 01/05/19 16:25

Hehe. Well, I haven't used C-Script in 11 years or whenever lite-C came along, but looking at the Gamestudio Wiki you can use regular DX9 shaders with it. Apparently, the postprocessing works the same as well, which is good.

Slin made some shader tutorial videos many years ago, I watched them but didn't get much from them (nonetheless they were my start into the world of shaders, so thanks for that!). You only need to understand the basic concept of rendering with shaders, everything else is straightforward (more or less) and learning by doing from there on.
For each vertex a vertex shader function is executed. It uses input such as position, texture coordinates, normals, does some calculations with them and writes the results in some registers. For every pixel on screen (not a texture pixel) when drawing a triangle a pixel shader function is executed where you can grab interpolated information from the 3 vertices (and vertex shader results) making up the triangle. On a very basic level this might be interpolated texture coordinates which you can use to sample a texture, for color, normal maps and all that good stuff.

Oh, there's an official tutorial I forgot: http://www.conitec.net/shaders/
Read "Introduction", "The D3D Pipeline", Workshop 1,2,5 for a start.
I have a default shader similar to the one from Workshop 2 and use it as a basis for most new shaders, no need to write it a new each time.
Posted By: jumpman

Re: Lighting Question - 01/06/19 14:19

@superku

Excellent work! How did you get multiple shadow casting lights?
Posted By: Superku

Re: Lighting Question - 01/06/19 16:44

Thank you!
I'm rendering all lights (views) into a single 16bit shadow atlas texture, as in DOOM (2016) (and probably many/ most other game):

My render/ lighting pipeline is not finished yet though, currently the number and types of lights are hardcoded into a single pass.
I want to make a quad based deferred renderer (for the lights) if that makes sense. That is let's say divide the screen into 8x6 quads, then calculate for each quad lights which touch the extruded quad volume in screen space and then process that quad with a custom bmap_process function. The latter is already implemented, for the most part at least, and allows to execute a pixel shader for sections of the target bitmap - which in my case could be a 16 bit HDR light color map, we'll see.
Posted By: jumpman

Re: Lighting Question - 01/07/19 18:34

WOW. All I can really say.

I love doom, and saw many talks and PDF's about their rendering and animation process, but here you are actually doing it. I think Conitec should hire you.
Posted By: Superku

Re: Lighting Question - 01/07/19 19:40

Haha there's still quite a few differences between DOOM's and my rendering but... thanks. wink
Yeah they have some good stuff in there, and it's nice of them to share it with us folks.
© 2024 lite-C Forums