Archive 17/01/2023.

Less realistic lighting

rku

This is what i got now. First picture from blender is to give you idea what i am trying to shade. Cube on the left is what i have achieved with a point light + Diff technique and diffuse texture.

auto lightNode = _scene->CreateChild("Light"); lightNode->SetPosition(Vector3(-1, PLAY_FIELD_HEIGHT, -2)); auto light = lightNode->CreateComponent<Light>(); light->SetLightType(LIGHT_POINT); light->SetCastShadows(true); light->SetRange(100); light->SetFadeDistance(100);

Any idea how i could get it lit so it looks like something like cube on the right? Basically i want each plane to geet same amount of light without taking into account distance from the light.

TheSHEEEP

I don’t know much about Urho internals yet, but an effect like that could be achieved in the shader code rather easily.

Usually, a light’s influence is calculated “realistically” by the angle difference between light direction and surface normal.
Instead of doing this realistically, you could introduce different angle ranges.

1: Angle is very large - medium: full light influence
2: Angle is medium - small: half light influence
3: Angle is “same direction”: no light influence

Not sure if the same could be done by C++ code only, but it would surprise me.

1vanK

Use flat shading in blender for model and directional light in urho.

EDIT : Or you mean cartoon shader?

codingmonkey

Ctrl+E - mark sharp

and then use EdgeSplit and apply modif

and only then do export

Mike

Did you set Flat Shading in Blender?

rku

Marking faces as flat shading in blender did the trick, thanks guys.
I also reworked mesh a bit, it probably helped as well:

rku

Actually there is one more problem i can not wrap my head around. Flat shading causes object to jitter a bit (like by one pixel or so) when moving. Changing it to smooth shading makes it move smoothly. Are there any workarounds?

1vanK

Use FXAA3 postprocess

rku

That changes nothing, that square part in the middle still jitters up/down by 1px when object is going down on the screen…

Edit:
To be more clear i made a video.