Yes I did it, I am bit confused with Directional Light Direction,
Could you please suggest me Direction Light Setting for this co-ordinate system.
Thanks,
Bala
Yes I did it, I am bit confused with Directional Light Direction,
Could you please suggest me Direction Light Setting for this co-ordinate system.
Thanks,
Bala
the direction is basically the vector the light is facing, so in my coordinate system Vector3(0,0,-1) would look straight down.
Itās not position dependent
In a Z = depth oriented camera you would have Vector3(0,-1,0) to look down
Not working! Not illuminating the Modelsā¦ Trying out different values with Direction.
Will let you know!
Thanks,
Bala
does it work if you disable shadows?
Great! Yes, It illuminates when Shadow is disabledā¦
How to get the Shaodws properly now, Any shader code has to be changes?
no, itās just likely that the objects are either not in the shadow area or are shadowed by something else. Change the position of the light, I canāt say how specifically.
Iām gonna integrate directional lights into the editor though maybe tonight
Yeah! Thatās great! Please let me know once done. Meantime I will try the positioning.
Why I am trying this coz my existing system is Y up co-ordinate, I would like to integrate and check the rendering scene.
If we could change the co-ordinate system easily, I could avoid plenty of Conversion and Matrix Multiplication.
Thanks a lot!
Regards,
Bala
Dx uses a left handed system, OpenGL right one.
@kosmonautgames finally, which one is used by monogame ? Iāve always thought z+ was the forward vector, +x right, +y up (which is used in my engine)
Is z and triangles flipping done when building according to the platform/API ?
You can tell from the static vectors in Vector3
Vector3 up = new Vector3(0f, 1f, 0f);
Vector3 down = new Vector3(0f, -1f, 0f);
Vector3 right = new Vector3(1f, 0f, 0f);
Vector3 left = new Vector3(-1f, 0f, 0f);
Vector3 forward = new Vector3(0f, 0f, -1f);
Vector3 backward = new Vector3(0f, 0f, 1f);
So unlike your engine itās right-handed with the +x-axis going right, the +y-axis going up and the +z-axis going backward (coming out of the screen).
Thanks for the update @kosmonautgames.
I have got it working too, Its good to see Direction Light with editor.
You are right, -z forward, my mistake as I donāt have my computer with monogame right now.
https://msdn.microsoft.com/en-us/library/windows/desktop/bb324490(v=vs.85).aspx
So according to this, the matrices are calculted to fit left handedness for dx and triangles flipped too? Or Dx11 is right handed too ?
Theyāre flipped in EffectParameter, check out the get and set functions for Matrix. For OpenGL there are no matrices vecause of how MojoShader works. It decomposes the matrix into an array of floats basically.
Made my lights āvolumetricā aka added volumetric fog around the lights. Makes no sense but was fun to do.
Right now only works with point lights and without shadows.
enable/disable with g_Volumetricā¦ something and/or in the light parameters IsVolumetric = true
What is the algorithm to generate volumetric lights?
Update:
With raymarching I can also check against shadows -> large gif incoming!
The algorithm I use for unshadowed is basically this
We draw a sphere per deferred point light.
So we know the position of the surface of the sphere per pixel.
We also know the position of the light center, the light radius and the camera position.
Therefore we can calculate the depth of the sphere with a pythagoras / cos(alpha) = b / c
c = distance from camera to light.
We can get the cos by making the dot product of (distance from camera to sphere surface , distance from camera to light center).
This way we can get the ābā or distance from camera to halfway between sphere surface entry and exit.
We can double the distance from the surface entry to b and get the whole travel distance for out light through the medium.
We just have to integrate some distance dependent function or fake some integral from the entry of the volume to the exit.
There are cases to consider, for example if the exit is early because an object is closer than the exit of our volume.
And if the camera is inside the volume the algorithm has to change a bit, too, since we now draw with flipped polygons, so our information is about the volume exit and not the volume entry any more.
There may be a better way to do this, but I just sat down with a piece of paper and did the math.
The shadowed algorithm is much much simpler, but much more expensive - we basically raymarch through the volume and check each raystep against our shadow map.
One could also raymarch for unshadowed volumes, but that would be needlessly expensive.
This is really cool kosmo do you have examples that use the vertex shader to do mesh warping. I took a long break because i was having problems getting the shaders to work properly with custom vertex data. Specifically the vertex shaders.
no what exactly are you looking for? Maybe just make a new thread and we can help you out.
Cosmo when i tried to run your app i got a null reference first chance exception, at the render.UpdateResolution call. It looks like the clientsizedchange is triggering it, before its initialized in game1 here.
screenManager.UpdateResolution(); calls _renderer.UpdateResolution(); but it is null.
To fix that. I altered the line in the clientsized changed block with a bool to skip it when its null. so it runs thru the initialization first which it does after initialize it should fire it again which it seems to.
In game1.cs
bool isInitializedOnce = false;
in private void ClientChangedWindowSize(object sender, EventArgs e) {
ā¦
if (isInitializedOnce) { screenManager.UpdateResolution(); }
in protected override void Initialize() { just before base.initialize
ā¦
isInitializedOnce = true;
the above may actually just be a little monogame quirk, i donāt think was ever fixed basically the receiver is called, when its added to the sender windowclientsizedchange, then later on as well after load, i forget exactly, but im pretty sure its a quirk, anyways.
Then this line shown below errors in the class Shaders with a sharpdx (hr) handle result code
Edit: this just turned out to be due to shader level.
public static void Load(ContentManager content)
{
...
**BillboardEffect = content.Load<Effect>("Shaders/Editor/BillboardEffect");**
is that my card or a bug.
Ill make a separate post when i have time to show a demo of what im having trouble doing.