Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd Jan 2017 14:29 Edited at: 23rd Aug 2017 14:43
I Updated the first post.
Version 0.1
• Added PCF(Percentage Close Filtering)
• Added Shadow_SetSunDirection(DirX#,DirY#,DirZ#) again
• Added Shadow_SetSunPosition(PosX#,PosY#,PosZ#) (The Shadow_Update() will work with that for now)
• Fixed the shadow area that appears outside the far plane of the light's orthographic frustum

You can use the the API now "somehow".
The only settings to play with are the camera Width, Height, Depth of the Sun and the Depthimage size for now.
You will need:
#include "math.agc"
#include "shadows.agc"
Shadow_Init(Width#,Height#,Near#,Far#,Distance#)
Shadow_AddObject(ObjectID,Animation)
Shadow_Update()

PSM(Perspective Shadow Mapping) and how it works:
First you create an depth image, in this case it is 2048, the greater the image the better is the shadow quality.
Now you must render the depth of the scene from the Sun's position to the depth image.
We do that by multiplying the Model,View and Projection matrices (MVP) and pass it to the depth shader set, which retrieves the depth of the scene.
The Projection matrix is not a perspective one like the default camera in AppGameKit but an Orthographic one like A Box as the rays of the Sun are nearly parallel.
The View Matrix is a LookAtMatrix in my case, which stores the direction and position of the Sun.
Now that we have the depth image we can pass the Matrices and the depth image to the shadow shader set.

The Light's MVP needs a bias Matrix to shift it to the centre, which is calculated in the shadow Vertex shader.
The shadow shader compares the depth of the image with the calculated depth and we can set the fragment to be in shadow.
If we would now render the final scene, we'd get a moire like pattern:

This comes from the limited size of the depth image, so multiple fragments can be sampled from the same texel of the deth image.
We can overcome that with an other bias for the shadow coordinates, so the depth gets smaller than the surface's depth.
It's still not ready there is moire pattern on the object and peter panning:

We can fix both issues with culling the objects front face, so only the back faces gets rendered, for the moment we rendering the depth image.
Still not perfect as there would be oversampling.
There are some areas outside the view of the light's orthographic frustum.
We fix that with clamping the image's pixels value to the last valid pixel and force the shadow value to be lit whenever the projected vector's z coordinate is larger than 1
Also if a large object isn't in the view frustum of the camera, but we should see its shadow, we must set the object cull mode to also render it outside of the frustum
If we now render the scene, we'd get the most basic PSM shadows

@Jack: you will want to play with Shadow_UpdateFrustumVertices() so comment it in
The problem is that the frustum vertices of the light's orthographic Box need to fit the cameras ones like so:

This image is from here Link

Attachments

Login to view attachments
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 24th Jan 2017 10:34
Imagine me dancing!
Thanks a lot, it is nearly perfect!
I got only one error, it appears if I want to delete Objects.

Quote: "Array index out of bounds, Index: -1, Array Length: 235 in shadows.agc at line 96 in shadows.agc at line 96"


My objects Nr is higher than 2000, is this a problem?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th Jan 2017 11:49 Edited at: 23rd Aug 2017 14:43
Oh, I mainly focus on having shadows not on removing them

This problem appears when the find method from AppGameKit can't find the object and returns -1
I just wasn't aware of that
also:

• Added Shadow_GetListLength() Returns length as Integer
• Added Shadow_GetListObject(Index as Integer) Returns object as Integer
• Added Shadow_RemoveAllObjects()
• Fixed bug where you get an error if you try to remove an object that isn't in the list

Updated the the first post
Thanks for testing ^^
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 24th Jan 2017 15:38 Edited at: 24th Jan 2017 15:45
No problem, thanks for fixing!
I need to remove objects in a editor...

edit: there is another error popping up when i now try to delete something.

Quote: "Error: Failed to set cull mode for object 2001 - object does not exist in shadows.agc at line 122 in shadows.agc at line 122"
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th Jan 2017 16:54 Edited at: 23rd Aug 2017 14:43
if you are not using Shadow_RemoveAllObjects() and this problem occurs in Shadow_RemoveObject() then just check if the object exists
It's fixed for the next version then

should I check what attributes the object had before and save it for each object e.g if it was front face culled or back face culled, if it was visible or had a shader attached before, and reset the states ?
I set the shader to "no shader" and set the culling on as this is the most common state.

if you now change these settings of an object with shadow, you would get strange results I guess... but I don't want to set and reset it every frame in the update function
what is the best way to manage these things ?
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 25th Jan 2017 01:14
I tested this on my Nextbook Android tablet and get a lot of shader errors and no shadows.
I guess we need to find out from Paul what makes the shaders work on Android.
The coffee is lovely dark and deep,and I have code to write before I sleep.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th Jan 2017 13:12 Edited at: 23rd Aug 2017 14:43
I still had a #version 120 in the pixel shader ...remove that...(but then you are not allowed to declare the poissondisk array in line)
I know that GLES don't like how I declare the lightMVPMatrix outside of the main so that is fixed by moving them in the main easily
but I get the error that there is an undeclared "posVarying" and "Tex1" in a pixel shader.
I have only one pixel shader with content and there is no Tex1 Variable at all and uvVarying seems OK
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 25th Jan 2017 14:14 Edited at: 25th Jan 2017 14:16
I tried and modified the code to evade the error:
Quote: "Error: Failed to set cull mode for object 2001 - object does not exist in shadows.agc at line 122"


caused by using this code:


by altering this part:


Well, it works, partly. I can delete the objects with no error, but the shadow is gone.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 25th Jan 2017 16:47 Edited at: 23rd Aug 2017 14:43
Actually you should not get into the situation that the object isn't in the Shadow_List
Sorry I wasn't specific about where you should check for the existence of the object: I meant in the Shadow_RemoveObject(ObjectID) function, so the Shadow_List is in sync with the objects
anyway you can also change your GetObjectExists(ShadowID) to GetObjectExists(Shadow_List[ShadowID].ObjectID) for now

Can it be that the object you are trying to remove doesn't exist, or your Shadow_RemoveObject(theObjectHit) runs twice ?
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 25th Jan 2017 16:54
I'll check and report. thx!
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 10th Feb 2017 12:16 Edited at: 10th Feb 2017 12:22
found the time to look into it

Quote: "anyway you can also change your GetObjectExists(ShadowID) to GetObjectExists(Shadow_List[ShadowID].ObjectID) for now"


this works, thanks a lot.

Attachments

Login to view attachments
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 10th Feb 2017 12:35
Green7: Impressive.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 10th Feb 2017 13:40 Edited at: 23rd Aug 2017 14:43
Ah nice to see.
Seems that you got Bit-masking working... is it 4 Bit ?

And I see that there is light leaking through some corner segments.
Try playing with the Bias.
I had it set to 0.0005, make it smaller until you get that Moire pattern on the objects again.
Also, I know there is a way to calculate a dynamic Bias from the surface normal, called scale-based depth bias.

Are you using the Win-95 theme
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 13th Feb 2017 09:47
@Mobiius: thx!

@janbo: Bit-masking? i got no idea. If it is working then by pure luck. I had a short search on google about it, and i still realy do not know what it is. may you explain, as it sounds interesting? I'm more on the artsy side of game dev. But i try to understand coding, i want to know how things are working.
The leaking in the inner corners is something i wanted to ask about. Now i know how to solve it. thanks!
I work on a XP machine with classic settings. guess i'm getting old...
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th Feb 2017 14:06 Edited at: 23rd Aug 2017 14:43
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 13th Feb 2017 16:59
Ah, i see! This thing! I did not know this opproach. I got autotile working, my own complicated way, but i have not all the parts textured, so i only built shapes like those shown.
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 21st Feb 2017 12:29
Im currently working on this, using the base code from here, to see if I’m able to get realtime cascade shadows into GG Loader.

Some of the stuff i changed:

Mush mush less shadow flicker.
Adjusted bias for more precise shadow with less artifacts.
Shadow_UpdateFrustumVertices fixed to “fit to screen” visible screen area fitted to shadow depth map.
Added cascade.
Perfect fade between cascades.
Added cascade distances to shaders.
Fade out shadow on last cascade, way out there.
Fixed self shadowing artifacts.
Implemented the latest shadow shader code i made for GameGuru.
No “if” branch used when performing shadow samples , so its super fast.
Removed #version 120 code and converted so it should work on mobiles.
TODO: Align camera point, to be exact units per texel to stop more flicker.
TODO: Clean code, sorry its a BIG mess i needed to remove most of this code to make compatible with GG Loader.

Still mush mush more work on this needed, when done, i will share the new Shadow_UpdateFrustumVertices and code to fit this project, so everyone can use it

Not sure if it will be to slow for mobiles (it will work), later testing needed, at least it can be used for desktop.

Sorry my mac is slow and make jerky bad videos



best regards Preben Eriksen,
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Feb 2017 14:40
Looking good. Can't wait to try it in my own projects!
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 21st Feb 2017 19:16 Edited at: 23rd Aug 2017 14:44
Finally, many thanks
Can't wait to get the Face palm and see what I missed.
give me the codez ! ... I can clean up myself ^^
By
Quote: "Align camera point, to be exact units per texel to stop more flicker"

you mean to round the minimum and maximum value in X and Y of the orthographic projection bounds ?
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 21st Feb 2017 19:41
Amazing ! i need this ! i want to test it in a complex and huge environment !

janbo and Preben : great work !
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 21st Feb 2017 21:07
wow! Great progress!
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 22nd Feb 2017 14:29
Great work Preben, I have nominated you for an AppGameKit master badge for all the work and help you have contributed to AGK.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 22nd Feb 2017 14:57
Thanks all , just remember janbo made the house im just cleaning up after him

Quote: "Can't wait to get the Face palm and see what I missed.
give me the codez ! ... I can clean up myself ^^"


Mainly its the new Shadow_UpdateFrustumVertices you need , It makes a border based on the diagonal length to fit it perfectly to the scene.

The c code that need to get converted ( to stop more flicker ) is also in here , fWorldUnitsPerTexel basically you need the center of the depth camera to hit a texel exactly , so it dont flicker when you rotate the camera, but im getting to this later. think im going to do this in the sunvector as you can see i change this so it will be possible.

Still a mess but you asked for it, BTW: you did a great job on this janbo


All: you cant just put this in the old code and make it run , it still need a little change here and there , coming later, this is just for janbo.
best regards Preben Eriksen,
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 22nd Feb 2017 21:05 Edited at: 23rd Aug 2017 14:44
I tested it

I recognized the code for the reduction of the shadow shimmering in a Microsoft example code somewhere.
It will help me understand what is going on...
So I'm on it.

I'm pretty sure that you don't need those lines

just

As we need the direction only not the length.
But you know that, right ?

Also you can save the sundir constant, because you can extract it from the MVP matrix
dirx, 0, 0,x
0,diry, 0,y
0, 0,dirz,z
0, 0 0,w

I would like to help you cleaning my house as I know some really dirty corners
And thanks again but its for us all anyway
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 22nd Feb 2017 23:36


Will be needed when the center of the camera must hit a texel ( direction must be very exact ), it is expanded to make it easier to adjust , but perhaps it should be expanded to distance before adjusted to nearest "unitspertexel# = Diagonal# / 2048.0" ?


best regards Preben Eriksen,
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd Feb 2017 00:05 Edited at: 23rd Aug 2017 14:45
So you went that way for precision ?
because floating point is not enough ?!
again because it can cause flickering ?!
I didn't made that experience jet
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 25th Feb 2017 17:15
janbo: the point is to rotate the shadow camera ( or sun position ) to make the camera always hit exactly on a texel. not got to that yet

Some progress: Got it working in GG Loader , removed more flicker. starting to look good

best regards Preben Eriksen,
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 26th Feb 2017 15:05 Edited at: 23rd Aug 2017 14:45
Quote: "the point is to rotate the shadow camera ( or sun position ) to make the camera always hit exactly on a texel. not got to that yet"

Yeah I know, but I thought that a float is precise enough for that purpose
else you wouldn't need to multiply it by 100 as we only need a direction of the sun/sun's camera
Or I miss something else...
A propos are you going to release the rest of the code or should I investigate in it for the community ?

Also your GG loader looks good im especially interested in the imposter system
It's the only thing I haven't made myself jet

Also make sure the first cascade near the player camera is big enough so objects behind you still cast shadows.
Thats what
was for.
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 28th Feb 2017 11:34
Quote: "A propos are you going to release the rest"

Sure i will update the code when im done

Quote: "imposter system"

Its a must on mobiles.

Quote: "Shadow_MaxZ#=Shadow_MaxZ#+10"

Not needed , the problem is agk culling , you just need to use "SetObjectScreenCulling(objectid[ml], 0 )" , then you also get shadows from objects behind you. I will update code when im done.

I will start on the mobile version today , the desktop version is working on mobiles but need some adjusting, mainly looks like the back face only depth buffer is not precise enough on mobiles ( got missing faces ) but i will fix that. Desktop version on ipad:



best regards Preben Eriksen,
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Feb 2017 13:28
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 28th Feb 2017 14:11
10/10 awesome!

[/url]
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 28th Feb 2017 15:47 Edited at: 23rd Aug 2017 14:45
Quote: "you just need to use "SetObjectScreenCulling(objectid[ml], 0 )""

That's not so easy.
I have screen culling in my system as you can see, but if your object is not in the depthbuffer there will be no shadow for it.
So as I said you normally give it a threshold at which distance the object is still captured by the sun's frustum that's what the +10 was for...I'm just saying

Quote: "Sure I will update the code when im done "

Thanks.
Don't take it wrong, but what if I shared my code only when I'm done ?
Probably there still wouldn't be a thread for shadow shader
I can work with messy code...
Hm that probably shows how badly I want to learn more about shadow shaders
So never mind take your time
I'll make my own solution
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 28th Feb 2017 19:55 Edited at: 28th Feb 2017 19:55
Quote: "I have screen culling in my system as you can see, but if your object is not in the depthbuffer there will be no shadow for it.
So as I said you normally give it a threshold at which distance the object is still captured by the sun's frustum that's what the +10 was for...I'm just saying"


Im not using any of that code , the new code will fit the scene so its not needed ( like in the code above ) so any object in the scene also behind you will cast shadows.
This is the code im using to display one cascade:



When im done i will need to copy/paste it back to get it working in this version.

Quote: "Don't take it wrong, but what if I shared my code only when I'm done ?"


Give an old man some air, i might be slow but as i wrote "I will start on the mobile version today ..." when im done i will copy/paste into this version so it will work for good or bad, no one need to use it if they dont want to, it was just an offer.
best regards Preben Eriksen,
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 6th Mar 2017 10:44
Hope this work on mobile... (i pray)...3d game without 3d shadow feature kind of incomplete. Should be top priority of AppGameKit update
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 8th Mar 2017 09:40
I have updated the code to support cascade shadows and it now also works on mobiles/mac

In the shader you can define the shadow quality:
//#define LOWQUALITY
//#define MIDQUALITY
#define HIGHQUALITY

On my iPad Air i get 60 FPS using HIGHQUALITY , but thats iPads max so cant say how fast it really is.

Attached new version. Enjoy!


best regards Preben Eriksen,

Attachments

Login to view attachments
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 8th Mar 2017 10:06
Hell- yeah! Thanks to all the peoples pushing this!
Green7
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: Switzerland
Posted: 8th Mar 2017 12:21
got one question: how do i change the density and color of the shadow?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 8th Mar 2017 21:32 Edited at: 23rd Aug 2017 14:45
Well done,
I glanced over it a bit and made some changes:
•Fixed a bug where the VertexLighting didn't get updated by the right normals in the Animation Vertex shader.
•Moved the andoid specific string parsing into the init function so it don't get called so often.
•Removed the sundir vector from the agk shader constant but made it varring
also it is created by the second last row from the MVPLightMatrix not like I stated at first.

3D Shadow Shader v0.4
I also updated the first post.

@Preben: Can you explain why we need the second depth shader...that PE you wrote in Shadow_Update ? I'm curious.

@Green7: what do you mean by density and color?
If you want to darken the shadow for example ...then you need to change the lightFactor variable in ShadowStatic.ps
Play with the 0.5 ^^

[Edit]I also want to thank Jack and Madbit for the math library support at this point[/Edit]

Attachments

Login to view attachments
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 8th Mar 2017 22:20 Edited at: 8th Mar 2017 22:26
Oh my god...its like a dream Thanks Janbo&Preben

Work on pc, but broadcast to android getting error about constant or something like that. BTW its great.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 8th Mar 2017 23:35 Edited at: 8th Mar 2017 23:45
Both the 03 and 04 versions run slow on my Ares NextBook 11 Android tablet, 10 fps.
The 04 versions has an error on the same tablet.

Error:
Vertex shader and pixel shader failed to link: The fragment shader uses varying sunder, but previous shader
does not write to it.

P.S. My mistake retested version 03 with mobile settings and now get smooth 60fps on Android tablet.
The coffee is lovely dark and deep,and I have code to write before I sleep.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 9th Mar 2017 01:32 Edited at: 9th Mar 2017 01:37
hoyoyo80 wrote: "Work on pc, but broadcast to android getting error about constant or something like that."


Same pb here on android mobile (MM 6.0.1 / ZTE Axon 7) => see attached screenshot
--------------------------------
Join us on dedicated AppGameKit WeeKChat :
https://week.chat/room/AppGameKit

Attachments

Login to view attachments
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 9th Mar 2017 03:36 Edited at: 23rd Aug 2017 14:45
I'm so ill that I can't sleep I'm constantly coughing and the only solution is to distract myself from it...so what is the best for that at 4 o'clock in the night (germany)
Right fixing bugs...

Well, my PC does have no problem with 0.3 or 0.4 neither my Nexus10 but my Honor8 does cry on both versions.
I fixed the issues for my devices... hope it helps your devices too
•There was a typing error regarding sundir
•Fixed global initialising of the MVPMatrix

Updated all 0.4 Links

Attachments

Login to view attachments
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 9th Mar 2017 06:12 Edited at: 9th Mar 2017 06:42
Also removed the const from biasMatrix just in case , so many different gl version
Added IsSupportedDepthTexture , and print an error if your device do not support depth buffers.

Older mobiles / older gles version will have problems as they dont support depth buffers , Its the same with WebGL it do not support depth buffers , im working on a version that pack in a float into a normal RGBA texture so a normal rendertarget can be used , but im having some troubles with "some" objects , here is a link to the current progress of the WebGL version:

TEST:
http://www.slungo.com/mobile/eastertest/GGLoader.html

Also to get it working on some mobiles you should set the resolution to 1024 , see "Shadow_Init" in main. and perhaps change to LOWQUALITY , MIDQUALITY.

Quote: "@Preben: Can you explain why we need the second depth shader...that PE you wrote in Shadow_Update ? I'm curious."

Yes when we are about to generate the second cascade the GPU is not yet done generating the first, so if we dont change the shaders, the 2 cascade depth buffers will look the same, its like the GPU is just adding to the first batch without taking into account that its a new depth buffer ( so its using the same uniforms , lightMVPMatrix) . Try it using the same shaders , its a big mess on slow GPUs , if your GPU is fast enough you will not see the problem.

Pic of the shadow in action on a real level





Attached new version 0.41.zip
best regards Preben Eriksen,

Attachments

Login to view attachments
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 11th Mar 2017 05:17
Possible to have shadow caster in fullbright? Anyway to make shadow darker and hard edges?
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 12th Mar 2017 11:21 Edited at: 12th Mar 2017 11:27
hoyoyo80: You need to implement contrast and brightness in the shader to make the dark side darker and the light side lighter

I changed the shader to allow you to control contrast and brightness.


If you like it even more dark you can expand the contrast and lower the brightness perhaps something like this:
#define CONTRAST (6.0)
#define BRIGHTNESS (0.3)
Will make the shadow really dark , but play around with the values

If you want to make the blur on the shadow more tight , to give a shaper edge change this:

To:


Or lower the value until your happy with the result
best regards Preben Eriksen,
hoyoyo80
7
Years of Service
User Offline
Joined: 11th May 2016
Location:
Posted: 14th Mar 2017 06:56
The best thing ever happen now. Thanks Preben,Jansbo and all. Keep it up
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 23rd Mar 2017 17:19
Is this going to the bundled shadow shader mentioned in the 2017 roadmap?
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 23rd Mar 2017 18:05 Edited at: 23rd Aug 2017 14:45
Not that I know of.

But I'll be there and make upgrades to any shader they present
Please do not insist on that phrase
Bigsofty
9
Years of Service
User Offline
Joined: 7th Nov 2014
Location:
Posted: 23rd Mar 2017 21:50 Edited at: 23rd Mar 2017 21:55
AGK2 really needs a bundled shadow feature, it would nice if the AGK2 developers acknowledged that here could possibly be a solution here.

Good game guys otherwise.
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th Mar 2017 06:51 Edited at: 23rd Aug 2017 14:45
Ofcourse I have nothing against TGC making a shadow shader after I made one, but I don't like it if I can't make changes to it easily ...for example if they just implement a command SetObjectShadow(ObjectID,Value)
I want to have access to the Matrices and render textures preferably
As this is not an engine but a programming language for me !

Login to post a reply

Server time is: 2024-05-04 16:09:39
Your offset time is: 2024-05-04 16:09:39