Not logged inOpenClonk Forum
Up Topic General / Help and Questions / Ingame rendering of meshes
- - By Pyrit Date 2015-04-19 20:55 Edited 2015-04-19 21:02
I have an object here that has some issues with it's lightning and HUD display.

In the first picture we see 2 problems:
1. The sides of the icecube are shaded pitch black. That made the icecube look pretty crappy.  The same goes for the lorry or the blimp for example. Pitch black sides of objects on illuminated tunnel background also look weird. Look at the lorry here or the mushrooms here.
Some sort of real global illumination would be pretty rad, but probably hard to implement...

2. The more obvious thing in the attached picture is how huge the icecube appears in the HUD. It's okay when the clonk is walking, but when the icecube points towards the player it gets ultrahuge. Ingame it's displayed fine though. When the clonk turns around ingame everything looks normal tough, so it's just the HUD that makes problems. I gues the FOV is too high and the camera too near?

3. In the second picture I gave the icecube a normal map, wich made it loose the black borders. Yay! But I suppose that's not really supposed to happen? :o Anyways, in the HUD it's pitch black now! :<

Here is the Icecube.ocd if someone wants to play around. To use it you have to change the CarryHeavy library. You habe to change

effect.mesh = clonk->AttachMesh(this->GetID(), "pos_tool1", "main", this->~GetCarryTransform(clonk));
to
effect.mesh = clonk->AttachMesh(this->GetID(), "pos_tool1", "Bone", this->~GetCarryTransform(clonk)); to make it work, because the bone of the icecube is called, well, Bone.

I hereby license the file Icecube.ocd under the CC-BY license
Attachment: Icecube.ocd (436k)
Parent - By Armin [de] Date 2015-04-19 21:53
2. reminds me of the old right-in-the-eye javelin. The javelin doesn't behave like that anymore.
Parent - By Clonk-Karl [us] Date 2015-04-24 02:55

> 1. The sides of the icecube are shaded pitch black. That made the icecube look pretty crappy.  The same goes for the lorry or the blimp for example. Pitch black sides of objects on illuminated tunnel background also look weird. Look at the lorry here or the mushrooms here.


We can play a bit with the shaders of course to avoid these completely black shading of the sides. If this is for a certain scenario, you could try putting a Graphics.ocg in that scenario, copy LightShader.glsl into it, and modify


        float light = 2.0 * lightBright * max(dot(normal, lightDir), 0.0);


to something like


        float a = 0.25;
        float light = 2.0 * lightBright * (a + (1.0-a)*max(dot(normal, lightDir), 0.0));


of course you can then play with the value of a a bit. Another possibility is to simply increase the 0.0 in the max() function a bit.

> 2. The more obvious thing in the attached picture is how huge the icecube appears in the HUD. It's okay when the clonk is walking, but when the icecube points towards the player it gets ultrahuge. Ingame it's displayed fine though. When the clonk turns around ingame everything looks normal tough, so it's just the HUD that makes problems. I gues the FOV is too high and the camera too near?


I wonder whether this could be improved somewhat by setting the near clipping plane a bit further away from the camera. I didn't have a chance to look at it yet ingame. On the other hand, if the object that the clonk carries is so big that it stretches all the way to the camera or even beyond, there's not much we can do. The camera positioning could take attached objects into account, i.e. basically move further away when the clonk is carrying something big. But it still does not take into account all the movements and rotations, and if we would take that into account as well, the camera would jump around a lot when the Clonk is moving. We should play around a bit with various possibilities, and it's good to have your ice cube object as a playground for that.

> 3. In the second picture I gave the icecube a normal map, wich made it loose the black borders. Yay! But I suppose that's not really supposed to happen? :o Anyways, in the HUD it's pitch black now! :<


This looks like a bug -- the normal map seems not to be used correctly when a mesh is rendered in perspective mode...
Reply
Parent - - By Apfelclonk [de] Date 2015-04-26 19:13
Would it be that of a performance issue if one would extend that lighting setup for meshes? I mean, with a 3-point-lighting system one could avoid these very ugly black edges of most round models. Or one could get rid of any seperate lighting and all meshes, landscapes and sprites (can they have normal maps too?) would take care of the same lighting sources e.g. the "sun", ambient light, the light emitted by the clonk ( he really needs a lantern instead of that supernatural glow ) and any light source added by the player (torches?). Probably its me, that I don't know the actual state of what has been done in the past months. I'm really happy about what has happend to the lighting and I know that its not fair to compare any Open Source project, and especially not OC with his very special development history, to what is common by the mass of recent games, but I feel like there is still some space for improvement.
Reply
Parent - - By Anonymous [de] Date 2015-04-26 22:22
We can just add an ambie t light component. No need to create tons of lights.
Reply
Parent - By Apfelclonk [de] Date 2015-04-27 11:02
Would that ever look as natural as one of my suggestions?
Reply
Parent - By Clonk-Karl [us] Date 2015-04-28 19:19
I don't understand what the actual suggestion here is, but I would strongly suggest to play around a bit with the shaders before jumping to conclusions about the current light system. For example, above I described a way to avoid ultra-dark edges.
Reply
Up Topic General / Help and Questions / Ingame rendering of meshes

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill