#URP transmission

1 messages ยท Page 1 of 1 (latest)

pulsar canyon
#

I don't think it requires anything special but here we go

hoary mountain
#

Oh, thanks

#

that thread title ๐Ÿ‘€ ๐Ÿ’ฆ

#

anyways okay back to what I was doing

#

Hey no error

#
{
    shadowMapDepth = SAMPLE_TEXTURE2D(_MainLightShadowmapTexture, sampler_LinearClampCompare, shadowCoord.xy);```
pulsar canyon
#

URP transmission

hoary mountain
#

@green quest where do I even get the shadow map texture to plug it in here? The other nodes dont output it, is one of them editable for that?

#

I will look in customLighting for any sampler-ing

#

some of it in here

#

thats its only use and it doesnt show where _MainLightShadowmapTexture is coming from

#

its not being declared or passed in

#

so im not sure how it can even see that ๐Ÿค”

#

hm

#

I tried deleting it

#

but its not a magic thing, now its says undeclared identifier

#

so it wants it passed in

#

I guess I need access to the shadow Texture2D now?

#

wil google to how to get that

green quest
#

Sorry was testing stuff. I'm using

SAMPLER(sampler_LinearClamp);

void Test_float (float3 WorldPos, out float3 ShadowCoord, out float ShadowDepth){
    #ifdef SHADERGRAPH_PREVIEW
        ShadowCoord = float3(0, 0, 0);
        ShadowDepth = 1;
    #else
        #if defined(_MAIN_LIGHT_SHADOWS_SCREEN) && !defined(_SURFACE_TYPE_TRANSPARENT)
        float4 shadowCoord = ComputeScreenPos(TransformWorldToHClip(WorldPos));
        #else
        float4 shadowCoord = TransformWorldToShadowCoord(WorldPos);
        #endif
        ShadowCoord = shadowCoord;
        ShadowDepth = SAMPLE_TEXTURE2D(_MainLightShadowmapTexture, sampler_LinearClamp, shadowCoord.xy);
    #endif
}
hoary mountain
#

Can't find the answer to how t oget _MainLightShadowmapTexture

green quest
#

It's a built-in texture that Shadows.hlsl defines, that's already included by SG/URP so don't need to pass a texture in

hoary mountain
#

oh when I removed the pass in from here, it said it was undeclared

green quest
#

But am struggling to get this to work still

hoary mountain
#

Im guessing your large block above accesses it the right way though?

hoary mountain
green quest
#

Nah should be okay

hoary mountain
#

your shadow depth outputs something

green quest
#

@hoary mountain Hmm

#

I think I got it working but not sure it looks that good tbh

hoary mountain
#

Hmm yeah indeed ๐Ÿค”

#

Could it maybe be due to the default light/shadow settings?

#

if that was blurrier it might work

green quest
#

I might need to sample the shadowmap multiple times. Similar to how "soft shadows" option works

green quest
#

Not bad

hoary mountain
#

Oh yeah that's leagues better already ๐Ÿ‘€

green quest
#

I'm using 2022.2.4f1 though so graph might not like opening in older versions

hoary mountain
#

Ah okay I am on 2020.3

#

If it doesnt want to open, can you post a screenie?, just in case

green quest
#

Oops line 86 in hlsl file should have WorldPos, not positionWS

hoary mountain
#

taking a look at this now today

#

I get an error but the preview is working

#

but in-scene its pink so I guess the error is in the non-preview code

#

lookin now

#

oh right you addresssed this

#

WorldPos, not positionWS

#

Yup that fixed it ๐Ÿ‘

hoary mountain
#

Hmm

#

working on this, trying to solve the edge

#

inverted looks good for how much light would transmit through

#

except at the outer edge

#

trying to figure out some way to invert all the values but not invert specifically the edge values

#

ooh almost

#

re-adding the shadow pass back into it after

#

bam no artifacting

#

get rekt subsurface scatter

#

I re-added the Light/Shadow into it to get rid of the dark edge

#

after multiplying it by a very large number in order to make the edge pure white

green quest
#

Ooh nice

hoary mountain
#

right now I am working to try to correct the discongrenuity at the outer edges

#

the bright band becomes a dark band when its inverted

#

but the transmission looks better with inverted values, except not at the edges ๐Ÿค”

#

trying to solve it so that with the inverted values, this doesn't happen

#

hmm so the values falloff from the edge of the shadow in both directions

#

I just need to.. somehow mask only one side of it? maybe ๐Ÿค”

#

transmission (red) and the shadow texture (green)

#

max of both

#

hmm min of both

#

maybe I need to add the min of both back to an earlier step

#

cant find the forest in the trees

#

running out of ideas

#

not good for my motivation or mentality, feeling defeated

#

gotta think logically

#

the value falls off in both directions

#

i feel like the shadow data must be the answer

#

when I try to use the shadow data though

#

there is always an ugly edge

#

its especially janked out if the edge is anything but white as well

#

sorta kinda almost

#

if I deliberately wash out the edge, and then saturate it, I can work with those values ๐Ÿค”

hoary mountain
#

I got it to stop shitting itself and compile

#

I think the problem was the same problem that was preventing your code Cyan from formatting correctly - I think there was some janked up character embedded in the unicode/ascii itself causing the breakage, like an illegal spacebar

#

i pasted it into notepad, saved, closed, reopened, pasted that seemed to fix it

#

hm I got that working but not sure how to use it yet

#

I should make a branch of my shader before I futz it up

#

looks like its only the y value I want to mess with

#

fml its all janked up

#

that is with normal bias 0

#

it was working before but somehow I broke it

#

oh it was bias at 0 on the shader

#

when it should have been 0.05

#

though im not really sure why/where/when/what 0.05 is coming from, magic number??

#

hrmg

#

as far as I can tell

#

whatever the render pipeline shadow bias is doing

#

its doing something irreversable

#

it rips appart when you add normal bias

#

but when you subtract normal bias, it doesnt un-rip apart

#

that or im just using it wrong

#

plugging it in directly doesnt work

#

just turns broken

#

it does a saturate

#

i think that saturate is destroying valuable data I need maybe?

#

hrmg no its saturating something else unrelated

#

im not sampling the shadow myself in there

#

yeah I have no idea at all what i a mdoing

#

im just plugging the one cord I have into every socket I have, with zero comprehension of what im doing at all

#

the unity thing doesnt show where or how that function gets used or called

#

wish there was some way i could see what i should be seeing

#

to then compare what i have against that

#

and then fix mine to match

hoary mountain
#

i tried to frame debug a basic lit default mat

#

but no luck ๐Ÿค”

#

ill give it a rest for today, its late, try more tommorow

#
float invNdotL = 1.0 - saturate(dot(lightDirection, normalWS));
float scale = invNdotL * ShadowBias.y;
positionWS = lightDirection * ShadowBias.xxx + positionWS;
positionWS = normalWS * scale.xxx + positionWS;
returnMe = positionWS;```
#

text that formats of that code

hoary mountain
#

taking another crack at this today

#

looking at varioys things and techniques to improve its appearance, still trying to get the jank resolved

#

ive currently given up fixing the normal bias and am instead looking for alternative methods to fix the shadow acne

#

because im not able to solve the normal bias

#

my best guess is that unity is doing something after applying normal bias that destroys the underlying data

#

thus making it impossible to reverse the normal bias afterwards

hoary mountain
#

hrgmh I found a fix that is not a fix

#

the janked up holes dont appear if the entire mesh is one smoothing group

#

but that fux up all kinds of other things

#

its like a ballancing act where every fix for one thing breaks two other things

hoary mountain
#

@green quest plugging away at this, I encountered something weird I don't understand.

#

some part of the mesh depth node is affected by camera position

#

not just camera position but even the size of the Scene viewport

#

I am not really sure what is going on to cause this

green quest
#

Hmm, well I think the shadowmap takes the camera's position into account.. somehow. That's why shadows only appear close to the camera, and are better resolution due to shadow cascades too.

#

Not sure why scaling the viewport affects that though, the camera's position there isn't changing... so must be something else

hoary mountain
#

I admit I am running into the situation where the shader grows and grows in complexity trying to reach the end I want and it becomes too large for me to comprehend or debug

#

The above is only the mesh depth node

#

adjustments to bias value doesn't appear to do anything to alter that behaviour occuring

#

here is where I am at if you want to take a look at anything

#

I keep remaking the shader from scratch because it grows and grows and never does what I want perfectly and then it grows so large in my pursuit of the look I want that im forced to start over

#

an extremely slow slog /vent

green quest
hoary mountain
#

maybe I did something dumb in here

green quest
#

Hmm looks similar. But I've got a lower Max Distance at 50, and my bias values are ~0.7

#

I'm also on 2022.2 so that might be why it's different but idk

hoary mountain
#

I will try those values, gif cap of the edge, maybe unity makes shadows simpler at screen edge due to 'optimization'?

green quest
#

I guess that's where the mesh is far enough away from the camera that it's going into the next cascade / lower resolution shadowmap

#

I think it might be best to ditch the shadowmap method of approximating the meshes depth and try to find alternatives.

hoary mountain
#

back to the drawing board ๐Ÿ˜ฟ

#

at distance 50

#

the meshes turn black if I go beyond 50

#

hrm maybe I can lerp the value to one or zero if the camera is a certain distance from the mesh

#

as another bandaid ontop of all my other bandaids

#

This method does look great when it works UnityChanThink but its feeling like the values that 'make it work' are very volatile

#

and very difficult to get them to do anything but their very specific thing

green quest
hoary mountain
#

Will read through, I am anxious that it will be beyond me to implement or debug but gotta give it a try to know UnityChanThink

green quest
#

Yeah I'm not too sure on the setup. I imagine you'd need to convert the shader to URP and use a custom renderer feature to render objects using it

hoary mountain
#

Hm one of the problems with my testing environment is that my test models are huge ๐Ÿค” i should probably be calibrating them down to the expected size

hoary mountain
#

@green quest How exactly does mesh depth work internally? I am trying to fix a bug with it but I do not understand how it works well enough to fix it

#

mesh depth works correctly until you leave the first shadow cascade

#

BUT for some reason if you add or subtract the light/shadow attenuation from the meshdepth, it works better

#

so some kind of magic number mystery function is occuring to the values/positions/??? at the values at each cascade

green quest
#

Perhaps this is a difference with cascades in older versions but when I used 2022 they looked fine, just a bit lower resolution.

green quest
hoary mountain
#

still working on it, still getting nowhere, do you know why its doing this?

#

It keeps doing strange behaviour in specific circumstances and its stopping me from moving forward until I can resolve all the weird things

#

I dont know why its greying at a certain distance like that

#

I can make it less noticable but I can't find a way to remove wtf its doing completely

#

and I need to remove it because its stopping me from progressing on the other parts of the shader

#

ive started over from scratch at least 10-20 times now

#

I just keep running into brick walls because I'm just too inexperienced to solve, and have no understanding or help in solving

#

How am I supposed to be combining these two different things?

#

because I feel like ive tried everything and gotten nothing

#

and im so completely lost

hoary mountain
#

i need that value to just increase linearly away from the light source's hit spot

#

but for some reason it does all kinds of weird shit that I cant explain

#

I definitely need help, plugging random things together, adding/subtracting.multiplying/etc other math

#

I'm just blindly plugging A into B until something works

#

but nothing works because I have no idea what im doing

#

@green quest something must be set wrong for this to happen right???

#

I really struggling, im really really struggling to fix this, to even grasp what is wrong

#

its been weeks now and im still no closer to solving

green quest
#

I'm not really sure, I guess it's caused by the shadow cascades but I don't know enough about them to know why / how to fix it

hoary mountain
#

Alright

#

thanks for replying, sorry I keep pestering you with this

#

I know how incredibly unattractive desperation is, I have no one else to turn to

#

I ask a lot of people for help but rarely will anyone even acknowledge that they heard my voice, I may as well be invisible

#

i dont know what magic combination of words i have to use to get the kind of attention that others seem to enjoy

#

i feel like im just a stupid useless no talent nobody who will never achieve anything or be anyone no matter how hard I try because i have no talent, no skill, no in born magic special quality to succeed and i dont know what difference successful people have, or how to obtain that thing they have

#

its so frustrating to be stupid but still want things, want to achieve, want recognition, want want want

#

im just a stupid envious jealous worthless piece of shit

#

where others can do, i can only dream

#

and then my desire for making nice things causes me to suffer because im a stupid worthless no tallent piece of shit

#

sorry you had the misfortune of helping me get started :/ ive only made your life worse

#

i dont even know why im bothering to type this, you're not reading it, you've moved on.
For me the day you helped me was the most important day of my life, for you it was tuesday

green quest
#

@hoary mountain Part of the problem might be that the questions you ask are very complex techniques - like this transmission. I also remember stuff about contour lines, volumetric rendering, parallax, refraction... maybe iridescence too?
It's understandable you want to learn and make things look good, but there's probably only a few people in this discord that can actually answer those types of questions. (There's not even that many active users answering shader questions in general)
I'd recommend trying to stick to what tutorials cover as much as possible until you actually feel comfortable with shader maths.

This transmission isn't stuff I've done before either, but I tried to help at least. I saw Remy mention it was possible to approximate the depth through the mesh with the shadowmap and that got me interested. But I've guessed some things - it's very possible the way I handled it isn't fully correct, hence these artifacts like the dark edge due to bias values and grey line as it switches cascades.
As I mentioned before, at this point I'd probably look into alternative ways to compute the mesh thickness, as the shadowmap isn't really meant for that and I feel it's got complicated with cascades involved. For example, maybe rendering the mesh with Cull Front and output depth values to a custom buffer (probably needs a custom renderer feature), then when rendering the normal pass sample and compare it against that fragment's depth.
Or perhaps you could even think about switching to HDRP where I think these kinds of techniques are already built-in to that pipeline, since it tends to be for much more realistic rendering than what URP can provide.

hoary mountain
#

and I know on the back of trying to do hard things, my mental health is ten pairs of handcuffs that makes it so much harder to do the things normal healthy people can do

pulsar canyon
#

These are the most fascinating type of effects but really seem to be on a level that's only expected of veteran graphics engineers
I relate to feeling kind of inferior when super talented tech artists show off their finest creations
But luckily for us most of nice tech art doesn't require anything super complicated and can be done with out-of-the-box solutions
At the end of the day making simply nice things is the goal, right?

hoary mountain
#

it hard to keep that in mind when part of me starts to just want it to be done, working, finished
part of me that says 'ive put in x hours so it should be done' and because its not, anguish

#

destination overtaking the proccess

hoary mountain
#

doing one final poke at this before moving on

#

I noticed something odd

#

main light shadows is black on the shadow side and a high value on the light side, this is as expected

#

mesh depth has that bright spot in the middle

#

but if you Maximum those two values together

#

the bright spot is greatly reduced

#

but maximum is taking the largest of two values UnityChanThink

#

so it shouldnt reduce the white spot

#

if you minimum it, its still dark as expected
but maximum is also dark

hoary mountain
#

I might be onto something

#

@green quest poking at this one final time and I might have found something meaningful

#

the node I use to get the main light/shadow has boolean keywords set inside of it

#

the same nodes outside of this return something totally different

#

because outside of this doesnt have those shader keywords

#

what is even more interesting is that your code from within this node, no change at all just the existence of those keywords completely changes its output

#

yours vs yours with those additional boolean keywords set

#

i am going to step away from your work like you suggested and go through jasper's tuts that recreate 'lit' from scratch, maybe insight will come from there

#

as well as cross referencing this

hoary mountain
#

reached out to them on twitter and their website, maybe ill get lucky UnityChanThink

#

with the correct keywords, your shadow depth output seems to be working better, I can clearly see it lerps the distance across each cascade

#

im beginning to suspect the lack of those keywords was the problem all along ๐Ÿ’ฆ

#
half ComputeCascadeIndex(float3 positionWS)
{
    float3 fromCenter0 = positionWS - _CascadeShadowSplitSpheres0.xyz;
    float3 fromCenter1 = positionWS - _CascadeShadowSplitSpheres1.xyz;
    float3 fromCenter2 = positionWS - _CascadeShadowSplitSpheres2.xyz;
    float3 fromCenter3 = positionWS - _CascadeShadowSplitSpheres3.xyz;
    float4 distances2 = float4(dot(fromCenter0, fromCenter0), dot(fromCenter1, fromCenter1), dot(fromCenter2, fromCenter2), dot(fromCenter3, fromCenter3));

    half4 weights = half4(distances2 < _CascadeShadowSplitSphereRadii);
    weights.yzw = saturate(weights.yzw - weights.xyz);

    return half(4.0) - dot(weights, half4(4, 3, 2, 1));
}```
#

you invoke this method in your thing, I am wondering if there is some kind of misalignment occuring between the URP shadow cascade settings and that

green quest
#

Yeah those keywords would probably be required. I think I did have them in my original graph I shared, but I guess when copied over you missed that - sorry should've made it clearer.

green quest
# hoary mountain

Still looks like there's some obvious lines as it transitions through the cascades though.. unless that cancels out after the matrix multiplication?

hoary mountain
#

What I -think- might be the problem is the unity notes say that the cascade points are not all centered on the camera

#

each cascade circle is actually offset away from the camera

#

and im wondering if maybe in yours its being calculated from the same static world position point?

#

repo from jasper's pdf, going to check their code see if they have the offsets for the spheres defined

#

๐Ÿ‘€

#

๐Ÿ‘€

#

lots of complex code

#

still havent found an explicit value

#

im still importing the porject

green quest
#

Hmm, I'm unsure if it'll help as the implementation may be slightly different. But could still be useful to look into

green quest
hoary mountain
#

buttload of errors upon import, probably because I didnt use the exact same version of unity

#

so now installing that through hub

#

current state atm

#

which is just yours but with the correct keyword booleans set

#

it doesnt do the weird thing until after the Distance step

#

I am trying to rescale the output values

#

but maybe im rescaling it wrong in some way

#

maybe it has to be rescaled before the 4x4, or im rescaling the wrong thing

#

jasper's proj still full of errors hrm

#

oh wrong version still

#

an array of matrixes UnityChanThink

#

old unity versions look soooo old

#

okay time to poke around inside here, since cascades appear to be rendering correctly here

#

none of that above is unity's render pipeline, its all their custom UnityChanThink

hoary mountain
#

a mystery tent for sampling shadows UnityChanThink

#

Im seeing matrixes

#

this might be where you got your matrix?

green quest
hoary mountain
#

ooh

#

yeah I saw this commented this was something else it turns out

green quest
#

Yeah there's were I got the inverse function. I'm hoping that's correct as I don't know how to fix it otherwise ๐Ÿ˜…

hoary mountain
#

I am still working my way through their render pipeline to see if I can learn cascade's secrets

#

๐Ÿค”

hoary mountain
#

this thing is the inverse function, but what is it doing UnityChanThink

green quest
#

Yeah to get the inverse of the matrix. So instead of going from world->shadowCoord, it can go from shadowCoord->world

hoary mountain
#

ooh okay ๐Ÿ‘€

#

_DirectionalShadowMatrices

#

Is the answer in here, under Shadow Matrixes?

#

reading it and trying to parse now

#
    Matrix4x4 ConvertToAtlasMatrix (Matrix4x4 m, Vector2 offset, int split) {
        if (SystemInfo.usesReversedZBuffer) {
            m.m20 = -m.m20;
            m.m21 = -m.m21;
            m.m22 = -m.m22;
            m.m23 = -m.m23;
        }
        return m;
    }```
#

hm wait maybe I want to sample shadows

#

oh this is that same directional shadows again

#

I thought I found a new proj to study

#

yeah I think ive hit a dead end, barriered by my comprehension

hoary mountain
#

We got further

#

but im now deadlocked again

#

and I was feeling good because I felt like I had finally found a lifeline, finally made progress

#

but now im back at square one dead in the water

#

and crisis is overwhelming me again

#

so I have to stop here for today

#

but like

#

tomorrow wont be any different

#

I still wont have answers or sollutions or miraculous realizations

#

stomach violently hurts as my body is screaming for me to stop working on this because of my repeated failures are causing me severe psychological anguish beyond anything i can cope with

#

but all I want is to be done, for it to be solved, to have the answer

#

and I dont have that and I will NEVER be happy ever again until I have it solved

#

but thats just my mental health screaming lies at me

#

maybe ill just spam jasper every day until he replies or blocks me

#

because I honestly have no other ideas or recourse to solve this

green quest
#

Not sure if it helps, but managed to remove the need for the inverse matrix multiplication (will perform better at least)
Seems to fix the dark edges issue from before too, without the need for the bias.
But still has the cascade seams, can't figure that out. They are much less noticeable when the Max Distance is quite high (e.g. 100) and the two bias values are <1 though. Might be good enough ๐Ÿคท

hoary mountain
#

I am trying to solve the cascade tihng and have an idea for that

#

fix it in post

#

literally re-create the cascade problem and subtract it from the result

#

the above is using hardcoded values of a distance of 50 with steps at exactly 25%

#

as a test

#

to see if doing this even works

green quest
#

I think it will be difficult to get it exact

hoary mountain
#

true but I have completely exhausted all ability to actually solve it, stupid hack patches are all I have ;-;

green quest
#

I think the problem is that the cascade spheres aren't perfectly on the camera's forward vector, I'm trying to figure out how to account for that but not sure how

#

Maybe I can transform them into view space then use the Z coord UnityChanThink

hoary mountain
#

Yeah they defintely arent, catlike jasper's thing says they arent but I couldnt find in there the means by which they are offset

#

they at least confirm that the offset is a thing

green quest
#

I can see it in the frame debugger, hold on

#

camera is at -27, 0, 3.92 here, looking down -Z axis

#

The offset is very small, but is there. Seems to be affected by the cascade split amounts & camera FOV as well.

hoary mountain
#

my attempt to recreate the exact cascade step problem is close but like you said, not exact

#

R = step, GB = cascade shadow sample

hoary mountain
#

Shader error in 'Shader Graphs/Plastic Light Transmission Shader Base': undeclared identifier 'GetMainLightShadowFade' at Assets/Shaders/Downloaded/CyanTransmission/TransmissionTests.hlsl(65) (on d3d11)

#

'GetMainLightShadowFade' function doesnt appear to exist

#

might be something renamed between unity versions? Im still on 2020.3

#

oh hm ๐Ÿ‘€

green quest
#

Ah okay, yeah it might only be in newer versions

#

Might be able to copy it but not sure if _MainLightShadowParams exists in 2020 either?

hoary mountain
#

one way to find out

#

rip, but if its just some values I might be able to feed them the correct values

#

oh nice its commented

green quest
#

Hmm that's weird, I'm checking the 2020.2/staging on the github Graphic packages and that does have the GetMainLightShadowFade function ๐Ÿค”

hoary mountain
#

maybe I need some kind of #include?

green quest
#

So bit weird you're getting undeclared

#

It's in Shadows.hlsl, so should already be included, same as all the other shadow functions

hoary mountain
#

Oh yeah good point

#

I dont see any missing ;

#

and that appears to be spelled correctly

green quest
#

Maybe the code I'm looking at include a backport or something that you're version doesn't have, hard to tell

hoary mountain
#

for now im going to try subbing in any old values for that vec4

#

strength, soft, light fade scale, light fade bias, that sounds like 1,1,1,1 to me

green quest
#

Might be able to leave the fade stuff out

#

Though you'll need to find a different way to handle shadows outside the Max Distance. Maybe it could be replaced with BEYOND_SHADOW_FAR(shadowCoord) ? 1 : 0;

hoary mountain
#

that looks pretty declared to me UnityChanThink

#

oh it has to be float4 bla bla bla

#

forgot the first bit

#

Okay got it not erroring pink

#

now to rebuild your new node flow

#

What is the swizzle doing, isnt xyz the regular order?

#

Or is it specfically to remove the A/W?

#

oh that subtract doesnt even go anywhere

green quest
#

Yea it was just to remove the A/W but I didn't end up using it. It's the position of the sphere, while the A/W stores the radius

hoary mountain
#

ah kk

#

rebuilt but the output is pure white in scene

#

Im guessing its because of my subbed in vec4

#

since otherwise its all identical

green quest
#

Probably, ignore the fade for now just output the One Minus result

hoary mountain
#

is this the expected?

#

oh yeah there are values there

#

Do I pump the output of the new nodes into this to get back to the earlier step?

#

ah yeah no distance being done here yet

green quest
#

The distance isn't needed anymore as it's done by subtracting the depths instead

hoary mountain
#

oh

green quest
#

The new graph/nodes replaces the old setup completely

hoary mountain
#

then I must be doing soemthing wrong

#

some light side values, none of what it used to look like

green quest
#

Hmm

hoary mountain
#

I can package export this

#

subtract is in the wrong order ๐Ÿ‘€

#

That was my mistake

green quest
#

Ah yeah, nice

hoary mountain
#

lookin good

#

cascade problem is still there like you said

#

but no more black bands or bias like you also said

green quest
#

Yeah and way cheaper since we don't need the inverse matrix calculation and matrix multiplication

hoary mountain
#

white bits seem harder edge than they used to be, but if thats unavoidable I can live with that

#

might also be a product of the values im passing in

green quest
#

I think that's linked to the normal bias in the shadowcaster pass so somewhat unavoidable.

hoary mountain
#

yeah different values also reduces it

green quest
#

Typically would keep both the bias values as small as possible and only increase them if there are shadow artifacts

hoary mountain
#

works good looks good (minus the cascade thing)

#

catlike Jasper got back to my email so I am going to ask them if they know about the cascade thing since their tutorial seemed to cover a lot about it when re-making the render pipeline

green quest
#

Could be wrong but I think it's got something to do with taking the sphere positions into account as I mentioned before (output of Swizzle node / Vector3 in your graph). I tried a bunch of things but couldn't figure it out.

hoary mountain
#

section 3.3 has a bunch of info and functions related to the culling spheres

green quest
#

Yeah I saw that. The visualisation of the culling spheres was nice

hoary mountain
hoary mountain
#

@green quest

#

How does that line up with the bunch of things you tried?

green quest
#

Pretty much yeah

#

The way the graph works is the same as how URP samples the shadowmaps. The cascade differences are there with that, but they aren't noticeable since shadows are a comparison between the two depth values (shadowCoord.z < shadowmap)
We only get the cascade problem when trying to stitch together the shadowmap depths from each cascade into a single depth from the light camera.

hoary mountain
#

i set up a scene to poke at the cascades

#

testing various values like resolution, aspect ratio, camera values to come to an understanding how the cascade values are derived

#

looks like the values change based on pretty much everything, clipping planes, aspect ratio, physical dimensions of the game screen, wether or not its perspective or ortho

#

oh nice your updated method outputs the cascade spheres

#

@green quest Do you know what spacial coordinate the sphers are in? They are positions, I'm guessing positions relative to the game camera's root?

#

or are they not positions but directions maybe?

green quest
hoary mountain
#

That is your CascadeSphere straight to the output

#

I am now trying to do my 'remake the steps and fix cascade by subtracting it out

#

but with the proper sphere data this time

#

but I am having trouble finding out where/what/how the sphere is positioned

#

relative to the camera? or relative to the object? Or some other third thing? and in what space?

#

gotta think logically ๐Ÿฆ†

green quest
#

They're in world space. XYZ/RGB is the position, W/A component is the radius

#

If you want them relative to camera you'd subtract the camera pos. Or for relative to camera's rotation as well, transform to view space.

hoary mountain
green quest
#

No idea really. If you just do distance calculations probably not

hoary mountain
#

got some data UnityChanThink

#

hm maybe I don't even need this, maybe I can just subtract your cascade sphere outputs

#

im missing something about CascadeSphere

#

is it one sphere? all four? something else?

#

looking at this, its... just the values of the largest sphere?

#

it cant be all four spheres, its only a single vec4

green quest
#

It's all 4 spheres, but switches between them based on what cascade the WorldPos exists in

hoary mountain
#

subtracting the spheres didnt work because the output value is a float and the sphers are vec3s

#

so I need to... distance them? from the camera world pos? then subtract that

#

This is all XY, what I should really be asking is "How do get the values I need to subtract the spheres from the transmission"?

#

and my Y to that X is what im trying to do there

#

subtracting made it worse, maybe gotta add it

#

that didnt work either

#

im missing something

#

the problem... is...

#

I cant just add or subtract from the whole thing

#

because that doesnt ballance the values at all

#

I need to... do something... with the cascade

#

I feel like there is room to explore here now

#

but not quite grasping it

#

updated package with my changes

#

I added a function that outputs the four spheres individually

#

in case that is useful or needed

#

You keep mentioning how the 4th value is the radius

#

but I am not sure how to use that or even what use it is

#

i am not comprehending, i can feel im not understanding a great deal

#

and its causing me distress so Im going to stop working on this for a few hours so that I dont go into crisis

#

next time I open this up ill move everything to world zero

#

because i have no idea how to even solve the effect let alone translate it all into the proper coordinates and solve the effect

#

too many variables for me

#

too much entropy, too many ways it can go wrong

#

i cant picture how its even supposed to be at world zero let alone somewhere off in space UnityChanThink

#

maybe I need to pass it into a step node and set the step value to be the 4th radius?

hoary mountain
#

cascades visualized as flat value bands UnityChanThink fingers crossed I can combine this with the before

#

getting very close, the difference with and without, the band is almost completely eliminated

#

I think I finally understand cascades

#

maybe UnityChanThink

#

the max distance is the over all range multipler, and the split values is how far pushed forward from the camera viewing angle that shadowmap cutoff starts/stops

hoary mountain
#

ITS SOLVED

#

lol rip, bot deleted for posting too fast

#

@green quest no discongruity ๐Ÿ‘€

green quest
#

๐Ÿ‘€

hoary mountain
#

well not that you'd notice with how compressed that gif became

green quest
#

How'd you solve it?

hoary mountain
#

I am multiplying the raw output by a flat ammount of value per each cascade band

#

mix values that work

#

briding the distance by forcing the values within a specific cascade sphere to be larger

green quest
#

I assume those values depend on the cascade splits set on the URP asset?

hoary mountain
#

for the moment yes

#

when you change the cascade points, need different multiplies

#

but at least it works, it may not be dynamic but hardcoded works

green quest
#

Yea well done ๐Ÿ‘

hoary mountain
#

I think I could solve it to be dynamic as well

#

mutiply the multiply value by the radius of the band in some way

green quest
#

Hmm, well the radius of the band/sphere is already being multiplied in technically

hoary mountain