Randomchaos MG Samples

OK, so today’s update is as follows:

Ported the Light & Shade posts I did in XNA

Posts in order








8 post in all, but I have only done post 1-3, 5,6 & 8

also note, the skull and teapot assets, while added in the solution do not compile with the MG content pipeline. So, I have added a per build event that copies them from another folder at the root of the solution.

xcopy /E /Y “$(SolutionDir)XNAXNAAssets” “$(TargetDir)Content”

Here are images from the 6 posts it does cover.

Light & Shade I
Ambient Light, Diffuse Light, and combined

Light & Shade II
Diffuse light with color, multi lights and specular (Blinn-Phong)

Light & Shade III
Color Maps, Glow maps, bump maps and reflection/specular maps

Light & Shade V
NVIDIA Glass shader

Light & Shade VI
Refraction and Reflection

Light & Shade VIII
Planet shader, multi pass.

Hope you guys find these useful :slight_smile:

3 Likes

Hi @Kwyrky,

I just updated the repo and removed the legacy halfPixel stuff :slight_smile:

Thanks for the heads up :smiley:

2 Likes

Today, I have started to port my old XNA fire shaders. The one done today is from this original post

Had some issue with it as it seems that MG does not like to import 3D Textures, but have a work around in there for now…

Here it is in action:

Gahh… One gif failed to upload, but it’s here on my twitter feed

Hope you find it useful :slight_smile:

1 Like

Tonight I have added some more to the Fire project, put in my old school fire too.




All from my archive blog:




Hope you find it useful :slight_smile:

3 Likes

Not checked in yet, but started to create a Deferred Lighting sample in my MonoGame repo. Looks like I have an issue with either calculating normals, or importing them :stuck_out_tongue:

If I do check it in today, it will not be ready, it’s still a work in progress :slight_smile:

1 Like

OK, coming together now, sorted my normal’s issue :slight_smile:


Might commit the first drop this afternoon :slight_smile:

1 Like

Just got shadow maps done too, just hope I can get it checked in today, I really should be working though :confused:

1 Like

Multi lights with multi shadows, soft and hard shadows shown here, just need to tidy the code and shaders up a bit now lol

2 Likes

Looks good! Are you planning to tackle point light shadows?

Yea, not sure how efficient they are though, as you are looking at a 6 way render per point light :confused:

You could update the shadow maps only if necessary.

It might be an option to go with paraboloid mapping which requires only two shadow maps but is a bit heavier to calculate and has other disadvantages like a visible seam in some cases.

1 Like

Ya i never could get parabolic shadow mapping to work right due to the seem which really is a deal breaker.
Would love to see a working example of that which is equivalent to a cubed shadow map.
.
.
.

Im gonna check this out when if i get a chance. looks succinct and in order.

Is that water just a quad with refraction or is that a actual model mesh warping under the vertice shader ?

Little bit more in there today, need to clock off in a bit though. Going to check it in, but please be aware this is a WIP :slight_smile:

1 Like

The water is a mesh, the wave function is done on the GPU. :slight_smile:

OK, checking this in, tidies the code up a bit and fixed a few tangent calcs in my primatives :slight_smile:



Hope you find it useful :smiley:

N.B. Not added point light shadows yet…

1 Like

So, was thinking about cross hatch shaders the other day and this morning found this articles for use with Unity, so just ported it to my samples repo :slight_smile:

I think I am going to take my material framework from my engine and put it in the samples so it makes doing this sort of stuff a little easier… may end up restructuring the samples all together lol

2 Likes

After reading @willmotil’s post here, I thought I might migrate a RTSP library I wrote to MonoGame, I guess you can do what you like with it, you may want to optomize the way I am loading the Texture2D, seems a little cumbersome, was easier in Unity, I could do a RawLoad from the IntPrt :confused:

Updated the RTSP streamer code as I found it had a memory leek in the unsafe bit. Hoping I fixed it anyway :smiley:

FYI,

Last night I added a FXAA post process to my Post Processing samples. The shader has been ported from a Unity tutorial I found here.

It’s not the final shader, it will need optomizing and Ill break it down in a tutorial at some point.

I have opened up one of the first Patron MonoGame tutorials I wrote last month to none Patrons. I may do this with other comunity posts as they age.


Sprite Batch Flag Shader Tutorial