#Rosy

1 messages · Page 4 of 1

vagrant musk
#

yeah
driver crashes can cause other programs to have problems, including crashes

astral hinge
#

cascading program failure

cloud rivet
#

oh

#

I forgot to actually send the index

#

so I was sampling with UB

wraith urchin
#

They are actually

cloud rivet
#

no I am setting it

vagrant musk
#

I’m surprised driver crashes don’t happen when training a pytorch model that takes like 100x the amount of memory your GPU has
… instead the program just crashes before the driver

#

pt probably has a check ig

cloud rivet
#

I will not sample but look at the index in render doc and match to where the csm is the descriptor

#

if I don't sample it won't crash

#

so I should be able to see all this

#

just going to look through how I set up the descriptor first though

vagrant musk
#

inb4 renderdoc crashes

cloud rivet
#

oh

#

I was using the sampler I created for the debug image

#

no I wasn't

#

fuck

#

maybe it's the 8K image KEKW

astral hinge
#

that's only ~250MB

true moon
#

It's quite interesting that memory profiling tools for GPUs seem to be not super common

#

You'd think every vendor's profiler would just tell you exactly how much memory is committed

astral hinge
#

AMD has a really good one called RMV

#

nsight graphics debuggeroni has a view that shows the memory usage of every resource but it's not as detailed as RMV

#

like RMV lets you take snapshots and compare them to see what got allocated/freed during a period. I don't think nsight has that

#

I think pix also has a thing similar to nsight

#

but yeah memory profiling tools aren't too important imo because you have most of the info you need in your app already

cloud rivet
#

ok

#

so it was ub descriptor indexes

#

I fixed it

#

I was allocating indexes incorrectly

#

VVL no use in this case, this is what matty was talking about how you lose saftey with bindless

#

well I figured it out anyway

#

8K shadows

#

looks pretty good actually lol

#

needs some PCF

#

let me try 4k now

#

looks like I got some shadow acne too

#

holy fuck though shadows make such a huge difference

#

looks great

#

damn this was so worth all the pain

#

honestly that was the least painful shadows have ever been I am getting better

#

I'm gonna fix that acne in a second but I want to see 4k now

#

well definitely worse with 4k but I can live with it

#

I will fix the shadow acne then

#

idk my existing PCF is not very good so maybe I can look into that idk

#

maybe it doesn't matter at my game's camera distance

wraith urchin
#

Also you are gonna wanna look into the different types of bias

#

To fix the acne

cloud rivet
#

hrm hardware pcf

#

I'm pretty happy with these shadows tbh

#

they could be better, but this is good for now I am going to work on either blending or normal maps next

#

I'm gonna post a #wip with a little shorter video and then go to bed

#

lol

#

doesn't count slang agonyfrog

#

🇬🇳

true moon
#

What is all that

brisk chasm
#

and i am jealous

#

my shadows never looked like they work :>

astral hinge
#

yes they did

#

I remember clearly that debug session we had and the big rock model

brisk chasm
#

ja that one time in the holiday camp

#

good times 🙂

#

rock4 something

steady venture
#

I just use "phi" "theta" "alpha". Not that this answers your problem.

steady venture
steady venture
#

(intense googling)

cloud rivet
#

I am really happy with this absolutely literal, explicit approach with no helper functions. I am never getting annoyed with my own abstractions. Making changes, finding code, it’s trivial

#

It’s all in a single file

#

My build is fast, it’s just great

#

There’s a lot of explicit repetitive blocks of code for creating buffers, samplers etc for example

cloud rivet
cloud rivet
#

I think I looked into it last month when working on shadows and couldn’t find anything

#

I am going to not work on shadows for a bit

#

Once I have an actual game and understand how shadows should look and work in the game I will revisit the topic

steady venture
#

Yeah I just looked it up shadow2DSampler or something

cloud rivet
#

the SPIR-V analogue is OpSampledImage maybe

cloud rivet
#

I need to read about SPIRV sampler filters

cloud rivet
#
   // If a variable ID or parameter ID is found in this set, a sampler is actually a shadow/comparison sampler.
   // SPIR-V does not support this distinction, so we must keep track of this information outside the type system.
#

I just think it's not a thing in spirv

#

I am not sure that shadow2DSampler is "hardware PCF"

#

I think it's driver implemented PCF

#

that's just what I am sort of already doing

#

I think the future of shadows is just RT

#

and I will probably add hybrid RT for better shadows rather than going down this rabbithole and running geometry through a render pass multiple times for worse looking shadows

#

and if you don't have RT hardware you don't have shadows idk

#

or you have shadowmap shadows that aren't as nice tbh, I can at least do that

#

directional light rays without any bounces are probably cheap? idk how hardware RT works

#

I'll probably do that for shadows as a next step, just turn on hybrid RT

#

conditionally turn it on

wraith urchin
#

It's something like sampler.compareEnable = VK_TRUE; sampler.compareOp = VK_COMPARE_OP_LESS; in bulkan

#

And probably VK_FILTER_LINEAR too

cloud rivet
#

PCF requires sampling multiple points yes

#

my sampler already uses those settings that are correct for a reverse depth

#

it doesn't automatically perform any PCF at the moment

#

without compare enable and compare op it just doesn't work at all

#

and results in a VVL I think

#

but with it turned on doesn't like multi sample

#

yeah I wasn't claiming that

#

the op (i.e. VK_COMPARE_OP_LESS )is different depending on what direction your depth goes (0 to 1 vs 1 to 0) based on your application's needs

#

is why I even said that

brisk chasm
#

yeah

cloud rivet
#

so you need an op, but it might not be VK_COMPARE_OP_LESS

brisk chasm
#

infintinitnie 1 to 0 you need GREATER, generally speaking

cloud rivet
#

but that doesn't give you any PCF like output

#

I just get the value for one fragment with that sampling

brisk chasm
#

you are talking about the depth you pass into the shadowShrimpler

cloud rivet
#

shadow2DSampler works totally different iirc

#

I used it shadow2DSampler in foundations, but I forget the details now

#

I think I need to do that multisampling thing as per that vulkan tutorial to get the same behavior

#

so yes, it does exist in VK but it's not shadow specific

#

and I don't know anything about it yet

#

it's not as simple as just using shadow2DSampler

#

that's probably something I'll look into soon

#

clearly it makes a big difference

wraith urchin
wraith urchin
cloud rivet
wraith urchin
#

Yeah in GL you need linear, I assume Bulkan is the same

cloud rivet
#

Linear filtering (VK_FILTER_LINEAR) computes a set of neighboring coordinates which bound the unnormalized coordinates. The integer texel coordinates are combinations of i0 or i1, j0 or j1, k0 or k1, as well as weights α, β, and γ.

#

yeah

#

oops maybe easy win

#

I just change that and things will look better

#

thank you

#

damn

#

easy to check right now tbh

wraith urchin
#

This VkSamplerCreateInfo stuff is actually really similar to the GL version

#

Maybe Bulkan isn't so much extra after all

#

Are you gonna do MSAA?

cloud rivet
#

ok so this is how it is now, let me try linear

cloud rivet
#

aw shit

wraith urchin
#

Depends what you mean by best

cloud rivet
#

                    sampler_create_info.magFilter = VK_FILTER_LINEAR;
                    sampler_create_info.minFilter = VK_FILTER_LINEAR;

                    sampler_create_info.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
                    sampler_create_info.unnormalizedCoordinates = VK_FALSE;
                    sampler_create_info.flags = 0;
                    if (VkResult res = vkCreateSampler(device, &sampler_create_info, nullptr, &shadow_map_image.shadow_sampler); res != VK_SUCCESS) return res;
#

I am using linear already

#

nm

#

I had previously linked NEAREST where I was referencing the sampler for the imgui image

#

oh well

#

I can do better PCF though in the shader

#

but I am not going to work on it now, I want to understand what my game actually needs and it may just be hybrid RT shadows and not a shadowmap at all

wraith urchin
cloud rivet
#

yeah I have a shader PCF it is garbage though

#

you can kind of see what it's doing in that image

wraith urchin
#

can I see your shader currently?

#

I have a hunch on why this isn't working

wraith urchin
#

The one that is supposed to be hardware PCF?

cloud rivet
#

I don't have any hardware PCF

wraith urchin
#

then what was sampler_create_info.minFilter = VK_FILTER_LINEAR; all about?

cloud rivet
#

so on line 71 in basic.slang

#

that sampler has the VK_FILTER_LINEAR

#

I sample float4 mapValue = shadowMap.Sample(shadowSampler, float2(vertex.x, vertex.y));

wraith urchin
#

VK_FILTER_LINEAR is for hardware PCF

cloud rivet
#

I don't understand I guess what you are trying to ask me

wraith urchin
#

I'm trying to get you to use hardware PCF to make your shadows look better

cloud rivet
#

yes, thank you

#

I have a shadow map texture that I wrote to in a render pass where each texel represents a projection of a coordinate in 3D space into that image, I sample by taking a vertex in my vertex shader and applying the same perspective projection to the dimensions of the image with xy coordinates

#

the depth value is recorded in the first color channel of the image

wraith urchin
#

How do you do a sample with a comparison in slang?

cloud rivet
#

it's just the color value in the red channel vs the z value of the projected vertex z

#

so the red channel's value in the shadow map is compared to my z

#

for that fragment

wraith urchin
#

like the equivalent of float textureLod( sampler2DShadow sampler, vec3 P, float lod); in glsl

cloud rivet
#

and if the value is greater than I show a shadow because it is occluded

#

yeah

#

that's different

#

there's an HLSL equivalent that I would use

wraith urchin
#

with hardware PCF you don't do the comparison yourself, you just provide the z value in P.z and the hardware returns a value between 0.0-1.0

cloud rivet
#

ok I think opengl drivers are doing some magic there you don't get in vulkan but that could be misinfo

wraith urchin
#

I can find the HLSL version 1 sec

cloud rivet
#

because I looked at sascha's implementation

#

and he's just doing it himself

wraith urchin
#

its used in MJP's thing

cloud rivet
#

and I looked at slang

#

yes I linked it previously

wraith urchin
#

in HLSL it looks the the func is SampleCmpLevelZero

#

maybe slang is the same?

cloud rivet
#

yep

cloud rivet
#

yeah I am using linear

#

I am not using SampleCmpLevelZero

#

I can try it out

wraith urchin
# cloud rivet I can try it out

It should be something like float pcf(float4 fragCoord, float4 vertex, texture2D shadowMap, SamplerState shadowSampler) { float result = 0.0f; float shadowOffset = 0.00025; // Sample some more locations; result += shadowMap.SampleCmpLevelZero(shadowSampler, float2(vertex.x - shadowOffset, vertex.y - shadowOffset), vertex.z); result += shadowMap.SampleCmpLevelZero(shadowSampler, float2(vertex.x + shadowOffset * 2.f, vertex.y), vertex.z); result += shadowMap.SampleCmpLevelZero(shadowSampler, float2(vertex.x, vertex.y + shadowOffset * 2.f), vertex.z); result += shadowMap.SampleCmpLevelZero(shadowSampler, float2(vertex.x + shadowOffset * 2.f, vertex.y + shadowOffset * 2.f), vertex.z); result += shadowMap.SampleCmpLevelZero(shadowSampler, float2(vertex.x - shadowOffset * 2.f, vertex.y - shadowOffset * 2.f), vertex.z); return result * (1.0 / 5.0f); }

cloud rivet
#

I will try that thank you

#

ah

#

it requires a different binding index

#

fuck

wraith urchin
#

Bulkan thing?

cloud rivet
#

it needs a separate descriptor binding index

#

because slange is like, no you're already using a sampled image sampler at that binding

#

and this is like a different type of sampler for slang

#

I think it would just be a new binding with the same type of sampler? this is init code stuff

#

hrm

#

I don't know if that's even possible

#

or I don't know how to do it

#

I have to read about it

wraith urchin
#

I'm not sure, I think you might need to ask #vulkan about that one

cloud rivet
#

maybe I can have a second SAMPLED_IMAGE on this


            const auto bindings = std::vector<VkDescriptorSetLayoutBinding>({
                {desc_storage_images->binding, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, descriptor_max_storage_image_descriptors, VK_SHADER_STAGE_ALL},
                {desc_sampled_images->binding, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, descriptor_max_sampled_image_descriptors, VK_SHADER_STAGE_ALL},
                {desc_samples->binding, VK_DESCRIPTOR_TYPE_SAMPLER, descriptor_max_sample_descriptors, VK_SHADER_STAGE_ALL},
                });
#

If flags contains VK_DESCRIPTOR_SET_LAYOUT_CREATE_PER_STAGE_BIT_NV, then there must not be any two elements of the pBindings array with the same VkDescriptorSetLayoutBinding::binding value and their VkDescriptorSetLayoutBinding::stageFlags containing the same bit

#

hrm

astral hinge
#

why do you need a second sampled image binding 🤔

cloud rivet
#
Compiled debug.slang successfully
C:\Users\Bjorn\source\repos\btipling\Rosy\src\shaders/basic.slang(6): warning 39001: explicit binding for parameter 'shadowSampler' overlaps with parameter 'imageSampler'
[[vk::binding(1, 0)]] SamplerComparisonState shadowSampler[];
                                             ^~~~~~~~~~~~~
C:\Users\Bjorn\source\repos\btipling\Rosy\src\shaders/basic.slang(5): note: see declaration of 'imageSampler'
[[vk::binding(1, 0)]] SamplerState imageSampler[];
                                   ^~~~~~~~~~~~
C:\Users\Bjorn\source\repos\btipling\Rosy\src\shaders/basic.slang(6): warning 39001: explicit binding for parameter 'shadowSampler' overlaps with parameter 'imageSampler'
[[vk::binding(1, 0)]] SamplerComparisonState shadowSampler[];
                                             ^~~~~~~~~~~~~
C:\Users\Bjorn\source\repos\btipling\Rosy\src\shaders/basic.slang(5): note: see declaration of 'imageSampler'
[[vk::binding(1, 0)]] SamplerState imageSampler[];
                                   ^~~~~~~~~~~~

Compiled basic.slang successfully
Compiled all shaders successfully
#

the samplers are bound at 1

#

and I can't have two of them

#

[[vk::binding(1, 0)]] SamplerState imageSampler[];
[[vk::binding(1, 0)]] SamplerComparisonState shadowSampler[];
#

that's not a thing you can do

#

so how else would I do it but create a separate binding

astral hinge
#

it's just a warning

cloud rivet
#

hrmmm

#

ok let me run it then

astral hinge
#

it's 100% legal in vulkan to do this

cloud rivet
#

Jake confirmed Vulkan MVP

wraith urchin
#

Jaker I think, not me

cloud rivet
#

I have the nicest shadows 🤗 thanks ya'll

astral hinge
cloud rivet
#

it's not AAA shadows (aka Jaker shadows) but I am very very happy with this outcome

brisk chasm
#

is that CSM already?

cloud rivet
#

I set it up to be a CSM but I am only rendering one cascade because of how expensive it is

#

and it seems to be good enough

#

for sponza anyway

cloud rivet
#

it added 2 ms to the frame

#

so I am up to 3-4 ms per frame now

#

so if each cascade costs 2ms

#

that seems a lot ya

#

and this is just for tiny sponza

#

I need culling to do cascade

#

but I don't think I need it for my game

wraith urchin
#

yeah it shouldn't take 2ms per cascade on a 3070

cloud rivet
#

I mean I need culling

#

well it's just rendering the same geometry as the render

wraith urchin
#

this is crytek sponza?

cloud rivet
#

yeah

wraith urchin
#

you should be getting better than 2ms for one cascade on a 3070 on crytek sponza

cloud rivet
#

without culling?

#

maybe it's the layers

#

let me disable layer messages

wraith urchin
#

yes without culling, unless maybe you have a pathologically large cascade

cloud rivet
#

the layers add overhead

wraith urchin
#

what is the cascade resolution

cloud rivet
#

4096^2

wraith urchin
#

yeah try disabling layers maybe

cloud rivet
#

doesn't seem any better

#

I can profile later

wraith urchin
#

GPU trace time

cloud rivet
#

yeah

#

it's just a bunch of draw calls gpAkkoShrug

echo crystal
#

are u rendering only to depth

cloud rivet
cloud rivet
#

looks like PCIe throughput

#

so uh

echo crystal
#

hmm

#

i have seperate position buffer don't know how much that affects

cloud rivet
#

I have that too

#

hrm

#

I think I need to put all my meshes into a single buffer

#

so the draws took 1ms

#

those pipeline barriers heh

wraith urchin
cloud rivet
#

yeah I don't know I have to manage all that myself, and I have never looked at it, it's using VMA maybe my VMA setup is wrong

#

because I have prefer device set up for those buffers

#

also

#

I need to just use one buffer

#

every mesh is its own buffer which is bad

wraith urchin
#

You sure you didn't allocate the vertex buffer in CPU memory by mistake?

cloud rivet
#

I don't dicate it

#

you tell VMA your usage

#

I tell it prefer device

wraith urchin
#

Yeah I dunno, ask in #vulkan maybe

#

but PCIe throughput being anywhere close to that looks very wrong

cloud rivet
#

actually I have this set

#
vma_alloc_info.usage = VMA_MEMORY_USAGE_AUTO;
                    vma_alloc_info.flags = VMA_ALLOCATION_CREATE_MAPPED_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT;
#

that's wrong

#

oops

#

wait that's my scene data

#

I don't need to read any data from host so I don't need access random bit

#

frame time went up +3x

#

@wraith urchin figuratively saving my life today, teaching me programming 101

wraith urchin
#

Np froge_love

cloud rivet
#

1.4ms -> 0.14ms for shadow pass

echo crystal
#

hehe nice

cloud rivet
#

all I did was not flag usage for random access why did I do that, literally had brain turned off

echo crystal
#

it's ok

#

everyone makes mistakes

cloud rivet
#

imgui theme update

astral hinge
#

AMD theme

cloud rivet
#

I got it from the graphics programming github org

#

I had to change it a little since it was outdated

#

something seems to have gone wrong

true moon
#

Apologies for the shitty take I'm a fingerstyle noob

cloud rivet
#

that sounds nice

true moon
#

Hopefully it sounds familiar

cloud rivet
#

I don't know music, so I do not recognize it

true moon
#

It's the dwarf fortress theme that plays in fortress mode

cloud rivet
#

ohhhh

#

yes

#

I recognize it!

true moon
#

That's why I'm posting it in your thread haha I wasn't just spamming

cloud rivet
#

yeah that sounds just like it

#

it's been a minute since I played

cloud rivet
#

nice

#

I just found out I had UB all this time because I was setting the material buffer size to vector.size() * sizeof(vector) instead of type in vector which is facepalm and I didn't break until I added alpha mode

#

also the faster frame rate led to me discovering I had a time step bug

#

because I was suddenly zipping around too fast, I wasn't tracking SDL ticks correctly

#

that's also fixed

#

lots of fixes today

#

maybe my game is just flying around sponza I am having fun just doing that tbh

cloud rivet
#

surface details and normal mapping tomorrow then I guess

#

then do that fancy lighting jake was telling me about

dry apex
#

nice. it looks way better

cloud rivet
#

thanks!

#

after fancy lighting I will add frustum culling

#

then I'll try intel sponza

wraith urchin
#

by "fancy lighting" do you basically mean PBR materials?

cloud rivet
#

what you were sharing the other day

#

I just have the n dot l atm

#

#1323084490997895198 message

wraith urchin
#

Ah yeah that was my GGX lighting code

#

should work

cloud rivet
#

I gotta add you all to the credits on this

wraith urchin
#

Did you do any normal mapping stuff back when you were doing GL?

cloud rivet
#

yes

#

I stole your grass

#

I was normal mapping it

wraith urchin
#

Haha lol, I think we just stole used it with permission from the same place

cloud rivet
#

the lengyel math is really good for tangent space stuff

#

shader objects made that so easy

#

I didn't have to make a separate pipeline

#

it was just like how I would do it in opengl

dry apex
#

imaging marrying there froge_love

cloud rivet
#

why do I not live in Crotia?

cloud rivet
wraith urchin
cloud rivet
#

yes

dry apex
cloud rivet
#

yes I have a 17 year old daughter

#

almost college age

dry apex
#

im about the same age as your child lmao

cloud rivet
#

:D

#

I'm young at heart

#

man croatia is pretty

cloud rivet
cloud rivet
#

I am going to at some point switch to premake

#

Not anytime soon but no reason to be able to not build cross platform with sdl and vulkan

brisk dagger
#

I need someone to volunteer however

dry apex
#

real

cloud rivet
#

this hobby doesn't help unfortunately

cloud rivet
wraith urchin
#

Yessss do MSAA!!!!

#

You need those crisp clean edges

silver slate
#

Unless you rely on a lot of shader magic that could really use sub-pixel levels of detail. :')

wraith urchin
#

There are ways of dealing with that

#

MSAA is the default in ASO

cloud rivet
#

yes

#

gonna do it in a bit

cloud rivet
#

it's gotta be painful to follow me on github as I am constantly spamming public work repos

wraith urchin
#

Lol it's OK, I don't really look at that part of github anyways

cloud rivet
#

lol

wraith urchin
#

Why is your work stuff public?

cloud rivet
#

it's open source

wraith urchin
#

Ah

cloud rivet
#

I just found a bunch that were missing license files

wraith urchin
#

Good thing my work code is hidden KEKW

cloud rivet
#

I'm mostly a manager these days so all my work stuff is just small bits, not a lot of interesting code

cloud rivet
#

ok I guess this is the most obvious example I could find of aliasing in sponza as a before MSAA picture

#

idk

wraith urchin
#

Can't wait to see the after

cloud rivet
#

is that better?

#

seems like it?

#

I seem to have lost shadows

#

what happened to the shadows

#

seems less aliased but no shadows

#

hrm

#

maybe I have to add a resolve mode on the depth attachment too? thonk

#

oh

#

I deleted my shadow pass while debugging

#

I forgot I did that

true moon
#

Lmfao

cloud rivet
#

ok ok what do we think

#

seems better?

echo crystal
#

yep

cloud rivet
#

that was hard

#

the vulkan tutorial was no use

#

well a little bit useful

#

I now have two draw images

#

hrm

#

maybe I don't have to blit into the swapchain now, because I can just resolve into it?

#

my frametime doubled

#

I'm going try removing the blit

#

and resolve into swapchain

#

I also went with absolute maximum sample mask size

#
                            vkCmdSetRasterizationSamplesEXT(cf.command_buffer, msaa_samples);
                            VkSampleMask sample_mask{ ~0U };
                            vkCmdSetSampleMaskEXT(cf.command_buffer, msaa_samples, &sample_mask);
                            VkExtent2D fragment_size = { 1, 1 };
                            VkFragmentShadingRateCombinerOpKHR combiner_ops[2];
                            combiner_ops[0] = VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR;
                            combiner_ops[1] = VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR;
                            vkCmdSetFragmentShadingRateKHR(cf.command_buffer, &fragment_size, combiner_ops);
#

maybe I can uh

#

sample less and still get good results

#

I'm going to test getting rid of the blit first

#

that actually made everything worse

#

time to profile

wraith urchin
#

How many samples is that?

#

4x is the sweetspot for me

cloud rivet
#

this is 8

wraith urchin
#

Cool

cloud rivet
#

ID,,Origin,Source,Message
12,,Target,GPU Trace,GPU Trace failed to initialize periodic sampling library. You might not have permission to access NVIDIA GPU performance counters on the target device.

#

cannot profile

#

hrmm

true moon
#

Don't you need to run nsight as admin

cloud rivet
#

oh I didn't before

#

let me try that

true moon
#

Maybe you crashed the driver and it's in a weird state

cloud rivet
#

ok running as admin worked

#

yeah it's the sampling

#

lemme try 4x

#

also I don't know what the sample mask should be

#

the tutorial doesn't use a sample mask

#

because it's old

wraith urchin
#

Wait are you using sample mask?

cloud rivet
#

yes

#

VkSampleMask sample_mask{ ~0U };

wraith urchin
#

Be careful with that, you can accidentally force the shader to be executed per sample

cloud rivet
#

hrm

#

ok I will 4x and then I will try adjusting the sampler mask

wraith urchin
#

Msaa will slow things down, but it should be manageable

cloud rivet
#

wow 4 made a huge difference

wraith urchin
#

Aso runs 4x by default

cloud rivet
#

I see a little bit of aliasing

#

frame time is much better now

#

still much better than it was

#

maybe msaa is more important at a big camera distance thinkeyes

#

this looks fine

#

I'm sticking with 4

astral hinge
#

pls make a magnifier tool in your engine

cloud rivet
#

oh

astral hinge
#

you can do it with imgui

cloud rivet
#

I actually have a thing

#

hrm

#

is that using the draw image as an image in imgui

#

I can do that

#

but

#

hrm

wraith urchin
#

Are you doing HDR tonemapping @cloud rivet ?

cloud rivet
#

it's being rendered into

cloud rivet
wraith urchin
#

OK if you end up doing tonemapping you will need to tonemap per sample

cloud rivet
#

I am going to make a github issue for a magnfier

#

how do you do anything per sample

#

it's just something I configured

#

I will figure that out I guess

wraith urchin
#

Texture 2d multisample

#

Not sure what they call that in bulkan

cloud rivet
#

I see

astral hinge
#

Read mjp's article about MSAA

cloud rivet
#
#

ohh

#

I see

#

the samples are stored

#

that explains why I can't blit the sampled image, it has to be "resolved"

#

into a 1 sample count

#

and so I am defining an image with 4 samples per pixel and the tone mapping would have to be applied to all the samples makes sense

#

I think I understand

wraith urchin
#

Yeah well you can do tonemapping post msaa resolve but it looks much worse

#

MJP's article explains why iirc

cloud rivet
#

yes it does

#

When resolving before tone mapping we’re oversampling the signal representing physical light being reflected towards the camera, and when resolving after tone mapping we’re oversampling the signal representing colors displayed on the screen.

#
  1. During MSAA resolve of an HDR render target, apply tone mapping and exposure to each sub-sample
  2. Apply a reconstruction filter to each sub-sample to compute the resolved, tone mapped value
  3. Apply the inverse of tone mapping and exposure (or an approximation) to go back to linear HDR space
#

hrm

#

I don't know what those last two points mean and they aren't explained I think

wraith urchin
#

Yeah don't worry about it unless you are doing tonemapping though

#

Eventually you will likely end up doing it though im sure lol

cloud rivet
astral hinge
cloud rivet
#

I see

#

this is a nice slide

astral hinge
#

I guess in this case we are probably trying to calculate the average value of the function (radiance at a point) within the pixel (which we can assume is a square)

#

so one naive reconstruction kernel would be simply averaging the msaa samples

cloud rivet
#

and that has to be done manually?

wraith urchin
#

Basically a box filter, is what happens with the default blit

astral hinge
#

yeah

#

idk how other kernels would look. I never tried it

wraith urchin
#

MJP has another sample on GH that uses other kernels

cloud rivet
#

so you have like a fragment shader that reconstructs the previous draw in a special pass for that? I don't understand

astral hinge
#

"reconstruction" means trying to figure out what the function that we are discretely sampling looks like

wraith urchin
#

I wasn't super impressed with the alternative kernels but gpAkkoShrug

cloud rivet
#

is that just configured?

astral hinge
#

wdym

cloud rivet
#

or do you have to write shader code

wraith urchin
cloud rivet
#

what code would you specifically write for "Apply a reconstruction filter to each sub-sample to compute the resolved, tone mapped value"

#

ok

#

I see

#

so it is done in a shader

wraith urchin
#

But also tonemapping per sub-sample needs a shader

cloud rivet
#

but the samples are part of the image you rendered into right?

wraith urchin
#

mine looks like cpp for(int i = 0; i < MSAA_SAMPLES; i++) { pixel += tonemap(texelFetch(color_texture, coord, i).rgb); } pixel *= (1.0 / MSAA_SAMPLES);

astral hinge
#

btw this is all signal processing theory

cloud rivet
#

is that fragment shader doing anything else?

astral hinge
wraith urchin
cloud rivet
#

so you have a shader that's sort of working with the surfaces and fragment data you got from the graphics pipeline, and then a later stage subsequent pass that now has the sampled data does all this work yeah?

#

I think I understand

wraith urchin
#

Yeah after everything is rendered to a multisampled target, this shader runs to sample all that and writes to a non-multisampled output

astral hinge
#

input: msaa texture(s)
output: single sample texture

cloud rivet
#

so this is done instead of just the "resolveMode" mode on an attachment

wraith urchin
#

If you need something more complex than that yeah

cloud rivet
#
typedef enum VkResolveModeFlagBits {
    VK_RESOLVE_MODE_NONE = 0,
    VK_RESOLVE_MODE_SAMPLE_ZERO_BIT = 0x00000001,
    VK_RESOLVE_MODE_AVERAGE_BIT = 0x00000002,
    VK_RESOLVE_MODE_MIN_BIT = 0x00000004,
    VK_RESOLVE_MODE_MAX_BIT = 0x00000008,
    VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID = 0x00000010,
    VK_RESOLVE_MODE_NONE_KHR = VK_RESOLVE_MODE_NONE,
    VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT,
    VK_RESOLVE_MODE_AVERAGE_BIT_KHR = VK_RESOLVE_MODE_AVERAGE_BIT,
    VK_RESOLVE_MODE_MIN_BIT_KHR = VK_RESOLVE_MODE_MIN_BIT,
    VK_RESOLVE_MODE_MAX_BIT_KHR = VK_RESOLVE_MODE_MAX_BIT,
    VK_RESOLVE_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkResolveModeFlagBits;
#

is all the modes you can use with resolving

#

depending on the image format

#

I am using VK_RESOLVE_MODE_AVERAGE_BIT

#

because VVL yelled at me to use it

#

because of my format

#

that sounds like what jaker was saying

#

so one naive reconstruction kernel would be simply averaging the msaa samples

astral hinge
#

ye that's the box kernel the other Jake mentioned

#

mathematicians have weird names for things

wraith urchin
#

One of these days I might mess with a Lanczos resolve kernel

cloud rivet
#

the video goes into detail on dealing with flickers and temporal stability

#

which looks like signal processing

#

alrighty thanks for all the information and resources I know a lot about msaa now

#

I didn't know anything this morning

#

I'm going to look at normal mapping

#

oh even my debug lines are smooth now

#

those were super aliased

wraith urchin
#

so smooth

cloud rivet
#

even imgui looks nicer KEKW

astral hinge
#

Hmm

cloud rivet
#

hrm it really makes a difference

#

video capture stutters agonyfrog

#

from a previous video I shared

#

clearly better

#

let me try to get exact same picture as that shot

#

even the roof texture looks better?

#

idk

#

could be because it's a screenshot of a paused video

#

anyway

#

It's all novel for me since I am new to this

#

but normal mapping now

astral hinge
#

The textures shouldn't look any different tbh

cloud rivet
#

well

astral hinge
#

MSAA only affects triangle edges

cloud rivet
#

I also enabled another thing

astral hinge
#

anisotropic filtering?

#

idk

cloud rivet
#

shading rate

#

e. MSAA only smoothens out the edges of geometry but not the interior filling. This may lead to a situation when you get a smooth polygon rendered on screen but the applied texture will still look aliased if it contains high contrasting colors. One way to approach this problem is to enable Sample Shading which will improve the image quality even further, though at an additional performance cost:

#

So I added this:

VkExtent2D fragment_size = { 1, 1 };
VkFragmentShadingRateCombinerOpKHR combiner_ops[2];
combiner_ops[0] = VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR;
combiner_ops[1] = VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR;
vkCmdSetFragmentShadingRateKHR(cf.command_buffer, &fragment_size, combiner_ops)
#

from the spec:

#

Each pixel in the framebuffer is assigned an attachment fragment shading rate by the corresponding texel in the fragment shading rate attachment, according to:

x' = floor(x / regionx)

y' = floor(y / regiony)

where x' and y' are the coordinates of a texel in the fragment shading rate attachment, x and y are the coordinates of the pixel in the framebuffer, and regionx and regiony are the size of the region each texel corresponds to, as defined by the shadingRateAttachmentTexelSize member of VkFragmentShadingRateAttachmentInfoKHR.

#

VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR specifies a combiner operation of combine(Axy,Bxy) = Bxy.

#

oh there's a glossary

#

Shading Rate
The ratio of the number of fragment shader invocations generated in a fully covered framebuffer region to the size (in pixels) of that region.

#

idk

#

was just trying to follow the blog post

astral hinge
#

Sample shading is kinda bad tbh (in terms of perf)

#

Regular MSAA guarantees exactly one fs invocation per texel where the triangle touches at least one sample

#

Sample shading just turns it into SSAA with a better sample pattern

cloud rivet
#

idk

astral hinge
#

Do you have mipmaps?

cloud rivet
#

yes

astral hinge
#

I guess the inner part of the roof consists of lots of thin triangles iirc, so MSAA should help with that

#

The other part is just big rects iirc so it should look the same in both pics

cloud rivet
astral hinge
#

Btw on mobile it's extremely hard to inspect pixels

cloud rivet
#

ah yeah there's a lot of geometry there

astral hinge
#

Every app I have either downsamples the image or applies a bilinear filter when I magnify it

#

That's why you need a magnifier frognant

cloud rivet
#

why are you on mobile

astral hinge
#

Because I just got back from the gym and I'm having a shake

cloud rivet
#

nice

#

I still have to exercise this evening

#

based on the msaa tutorial I thought I would do that in like 30 minutes

#

but nope

astral hinge
cloud rivet
#

I made a github issue for a magnifier

#

I will add it

astral hinge
cloud rivet
#

yeah

#

also every tutorial everywhere is still render pass

#

unless it's "modern" and then it just uses compute

#

but nobody talks about shader objects

astral hinge
#

It's kinda a viral AA effect, arguably more so than TAA

cloud rivet
#

or even dynamic rendering

#

although I didn't even think to look in any of my vulkan books about msaa

#

I bet they have that

#

fuck

wraith urchin
#

He's gotta do A2C now too froge_love

astral hinge
#

I wanted to use MSAA in my voxel renderer but I started rethinking it after I realized how annoying it'll be (it will likely not be a forward renderer)

wraith urchin
#

Yeah deferred rendering kinda killed msaa in the mainstream

#

But it just looks so good, I gotta have it

cloud rivet
#

looks cool

#

hrm

#

I feel like I should calculate the tangent in my asset packager

#

hrmmm

#

I'm gonna do some not very good tangents as a first step

slender ember
#

If you are using something like Assimp you can have it calculate them for you

cloud rivet
#

I am using fastgltf

#

oh maybe it has something

#

that's a good idea

slender ember
#

Yeah, not sure what it provides.

cloud rivet
#

btw loved your cargo loading asset building video froge_love you're so skilled at blender and uh everything

#

I learn a lot from your videos

slender ember
#

Thanks, yeah safe to say things didn't quite pan out how I imagined during the stream, but at least we got a cargo rack and a crate out of it 😄

cloud rivet
#

uv maps in blender are super weird for me too, so was happy that it wasn't just me

#

let me see about tangents in fastlgtf so I'm not doing unnecessary videos

slender ember
cloud rivet
#

already watching lol

#

I get those notifications

#

oh

#

I don't get notifications for shorts

#

why is that

slender ember
#

Oh, I deleted the notification actually from the channel. Most of my shorts are just short clips of stuff people have seen already, so I don't want to spam them there.

cloud rivet
#

oh ok

#

true

slender ember
#

I was trying to figure out if Sapphire can be configured to post different kinds of videos (normal, live, shorts) to different channels but haven't found a way yet.

#

That way people could just mute channel if they are, say, not interested in a certain kind of upload, but meh...

cloud rivet
#

I see other servers use roles for that

#

instead of channels

#

so if you want to be notified for one thing and not the other

#

you take the role

slender ember
#

Yep, I have seen that too but that kinda seems like a workaround.

cloud rivet
#

the music was good too

#

that's the kind of music I also listen to while working on my project

slender ember
#

Nice to hear, some people have asked me "Could you change the shit music?" 😄

cloud rivet
#

what, it's good

slender ember
#

I have a few "stream safe" pieces that I typically use. I should probably change them up a bit more.

cloud rivet
#

I didn't see anything for tangents so I'm gonna do a first attempt, and if it's ok for crytek sponza call it, but if it isn't I'll do something more complex I have in my math books

#

just going to yoink exactly what's in the book

#

wait

#

well the approach

#

not going to take copyrighted code 😅

true moon
#

Which is an easy way to do planar parts like that anyway

slender ember
#

Absolutely, it's not that I don't know how to fix it, but rather an interesting quirk with how the standard unwrapping in blender gets tripped up by this shape.

true moon
#

Honestly blender's UV editing leaves a lot to be desired

#

I remember when I switched to blender from 3ds max years ago the two things I missed were the nondestructive modifier stack workflow, and the more robust UV editor

#

Blender's is pretty rudimentary

cloud rivet
#

why did you switch?

true moon
#

3ds max is expensive and my student license expired

#

Blender is ubiquitous and still really good overall

#

It's just not better in every way

slender ember
#

I have only done rudimentary modeling in 3DS Max so I can't compare the two regarding their UV workflow.

#

But I will say that with the ZenUV and Packmaster3 extensions installed the UV workflow in Blender is much nicer.

true moon
#

It just had whole-island modification algorithms like being able to pin certain vertices and then relax the rest in various ways which gave more control over how organic shapes get unwrapped

#

Yeah I haven't messed with the extensions yet I think I have one UV editing one but it wasn't too helpful

slender ember
#

ZenUV + Packmaster3 = chefkiss

true moon
#

I'll have to try them

slender ember
#

Keep in mind if the standard UV stuff starts to wear you down.

#

They are both paid though.

true moon
#

Ah alright

slender ember
#

But nothing compared to a 3DS Max license 🙂

true moon
#

I'll still see what features they have and if they solve problems I have

#

I don't do that much modeling since I just make intentionally shitty placeholder art for my project with very rudimentary texturing

#

I have never really tried to turn a high poly hard surface modeling project into a game asset

slender ember
#

Small world. I make intentionally shitty low-effort final art for my project with very rudimentary texturing.

true moon
#

No lol your assets are beautiful

#

Mine are like this

#

#1147711082702589973 message

cloud rivet
#

I like your assets, they are on brand for your game

#

shitty is what my enderman thing from my last game looked like KEKW

slender ember
#

Well, I mean I don't even have skeletal animation in the engine, so I couldn't do that...

true moon
#

#art-discussion message

#

My philosophy

#

I started out doing high poly stuff long before I got into graphics

#

But learning to actually move quickly and make game assets required a very deliberate change in mindset

cloud rivet
#

yeah I plan on not doing anything high poly

#

I think high poly is hard to do when you're building your own engine and everything else

true moon
#

It's a good skill to practice, just separately

cloud rivet
#

I'm gonna be starting real soon

true moon
#

You need to practice both to have a well rounded set of skills but you can skip over it at first

cloud rivet
#

yeah true

true moon
#

Making stuff that is intentionally, comically low quality like that airplane in the message I linked helps stay on course and not get lost in the sauce

cloud rivet
#

I'm thinking about what my character will be like

#

it's an obsolete worker bot

#

so I feel like the model should sort of be something associated with whatever it was doing for a job

#

like if it's a mobile trash compactor or some kind of welder bot or somethign I haven't figured it out yet

#

kinda funny to be playing a mobile trash compactor trying to escape a place trying to reclaim you for parts

slender ember
#

Strong Wall-E vibes

cloud rivet
#

yeah, I gotta do something original

slender ember
#

Oh, there's place in there to do something original.

#

Wall-E turned into some sort of philosophical movie about the human condition half-way through...

cloud rivet
#

as pixar is wont to do

#

hrm

#

it's not going to be trash related

#

the obsolete robot escape room game idea is kind of fixed, I keep thinking all the small robots that are already in media, in star wars, pixar, etc and it's probably the wrong approach

#

it'll come to me

#

ok I got some not very good tangents I guess I should do some tangent math then, let me yoink what I had in my opengl project and see if that works so I can go to bed at a reasonable time

true moon
#

You don't have to figure it out all up front

#

You just need enough for the next few months of work and it will evolve organically as you go

#

Just keep a notes.txt in your project files and write down all you ideas and you'll probably find yourself accruing more ideas than you'll ever have time to implement

cloud rivet
#

yes notes are great

#

well

#

this isn't even remotely correct

#

but it looks cool

#

that just doesn't even make any sense

#

there's some ub or something

#

oh

#

the black area are positive coords and the rest are negative or have at least one negative component

#

I have to look at my math tomorrow, this didn't work

#

shortcuts never work smh

#

I can just fix this in my asset manager I think the rest of this is probably ok

brisk chasm
#

gltf supports tangents naturally

#

ah discord, thanks for scrolling

#

eh just make sure you export them in blender when you export to gltf

steady venture
steady venture
steady venture
#

Awesome progress as usual by the way Bjorn

wraith urchin
#

Or use mikktspace

hushed creek
#

Mikuspace froge_love

brisk chasm
#

re HDR

#

the inotherpeopleswallslivver did a great deal of hdrisms in frogfood (powered by john's venerable kunilingus)

cloud rivet
#

nice

#

I will be sure to take a look thank you

cloud rivet
#

part of really wants to spend some time on the stupid broken slang visual studio extension and fix all the problems with it

astral hinge
#

hey did you have an issue with putting the vs and fs inside the same file with slang?

cloud rivet
#

nope

#

works fine

#

just gotta use the "main" as the name

#

for both

#

for some reason

astral hinge
#

@harsh ginkgo

cloud rivet
#

oh no I am being raided

#

btw I am using shader objects idk if that matters

astral hinge
#

he was having an issue but he called the functions something else

cloud rivet
#

not that weak sauce shader module stuff

#

yeah don't do that

harsh ginkgo
#

well you gotta compile shaders anyways

#

OH

harsh ginkgo
cloud rivet
#

also

#

I compile with

astral hinge
#

it seems quite cursed to have two mains in a file, but I think that's because my brain is corrupted by c++

cloud rivet
#

no no

#

they're not called "main" in the slang

astral hinge
#

oh

cloud rivet
#

that's what I put on the shader object

astral hinge
#

oh does slang just generate entry points with main

cloud rivet
#

you can give it a cli argument to use the name

#

but it's more fun to just give it a file imo

#

and then it figures it out

#

it's just when you do that I think you have to use the string "main" on the SO thing

#

let me find that code

#

I am pretty sure if I call it something else it freaks out let me try it

astral hinge
#

not too bad

cloud rivet
#
2025-01-30 03:05:06.5875887] [ERROR] [Validation] Validation Error: [ VUID-VkShaderCreateInfoEXT-pName-08440 ] | MessageID = 0x571dc788 | vkCreateShadersEXT(): pCreateInfos[1].pName `wtfmain` entrypoint not found for stage VK_SHADER_STAGE_FRAGMENT_BIT.
The Vulkan spec states: If codeType is VK_SHADER_CODE_TYPE_SPIRV_EXT, pName must be the name of an OpEntryPoint in pCode with an execution model that matches stage (https://vulkan.lunarg.com/doc/view/1.4.304.0/windows/1.4-extensions/vkspec.html#VUID-VkShaderCreateInfoEXT-pName-08440)
[2025-01-30 03:05:06.5887832] [WARN] [Performance] CreatePipeline: failed to parse SPIR-V: 2
[2025-01-30 03:05:06.5890384] [WARN] [Performance] CreatePipeline: unexpected compilation failure
[2025-01-30 03:05:06.5892772] [WARN] [Performance] CreateGraphicsPipeline: unexpected failure compiling SPIR-V shader: 0x3b28c47a8529802c
[2025-01-30 03:05:06.5896968] [WARN] [Performance] CreatePipeline: failed to parse SPIR-V: 2
[2025-01-30 03:05:06.5899360] [WARN] [Performance] CreatePipeline: unexpected compilation failure
[2025-01-30 03:05:06.5901774] [WARN] [Performance] CreateGraphicsPipeline: unexpected failure compiling SPIR-V shader: 0x3b28c47a8529802c
[2025-01-30 03:05:06.5904759] [ERROR] Error creating shaders: 243
[2025-01-30 03:05:06.5907179] [ERROR] Asset setting on graphics failed: 1
[2025-01-30 03:05:06.5927839] [INFO] Engine deinit start
[2025-01-30 03:05:06.5930920] [INFO] Graphics deinit start
[2025-01-30 03:05:06.7344592] [INFO] Graphics deinit end
#

yah

#

I looked out the output in renderdoc once

#

and it's like literally "main" in there, even though it also has the actual function name in spirv too

#

it's so weird

#

pCreateInfos[1].pName wtfmain entrypoint not found for stage VK_SHADER_STAGE_FRAGMENT_BIT.

#
[shader("fragment")]
Fragment fragmentMain(BasicVertex basicVertex: BasicVertex, CSM csm: CSM, float4 fragCoord: SV_Position) : SV_Target
#

so it's not wtfmain and it's not main

#

I called my shader basic that's because what it is, basic

#

I should call the whole project basic

#

I think my lightdir is fucked

#

idk

#

this is in tangent space

#

like wtf is this

astral hinge
#

sponza just has kinda fucked tangents

cloud rivet
#

uh

#

well blender doesn't have any issues with it

#

if blender can render it so should I right

harsh ginkgo
cloud rivet
#

I should try that mittick thingy

cloud rivet
harsh ginkgo
cloud rivet
#

I love slang though

#

modules are awesome

#

I am so glad to not write glsl and have to declare a bunch of glsl extensions and deal with glsl scope

#

slang has actual scope

harsh ginkgo
#

sure sure, I just mean that as an "authority" I can't earnestly say its 100% ready for primetime

cloud rivet
#

right right

#

I agree

#

this is just a hobby for me so I just wanted all the fancy new stuff

#

ok so this light dir is a clue

#

ohh

#

I should just render the tangent

harsh ginkgo
#

same same, this is for 'research' and not production after all

cloud rivet
#

the visual studio slang extension is missing a bunch of quality of life features

harsh ginkgo
#

how do I get vertexID in slang?

cloud rivet
#

it's just the same as HLSL iirc

#

I read both slang and hlsl docs

#

I have never used HLSL so not sure

harsh ginkgo
#

oh okay, I had :SV_position which was wrong

#

I don't get output but I do get no validation errors

cloud rivet
#

sv position is what you output I think

harsh ginkgo
#

ah weird, well lemme renderdoc this up

cloud rivet
#
public struct VertexStageOutput
{
    public CoarseVertex coarseVertex : CoarseVertex;
    public CSM csm : CSM;
    public float4 sv_position : SV_Position;
};
#

I am not a reliable source of information about slang though

#

or anything

astral hinge
#

but you are a source of information froge_yeehaw

cloud rivet
#

yes mostly misinfo

harsh ginkgo
#

I'm happy with sources of information. Most of mine are the docs and those don't respond to questions.

cloud rivet
#

well I at least have code that seems to work

#

ok it's the tangents

#

that's the tangents I exported from blender

#

hrm

#

let me look at renderdoc

#

that's the tangent there for that side

#

that's the other side

#

the w is negated on one side

#

so

#

float3 bitangent = normalize(cross(normal, tangent)) * v.tangent.w;

#

so that w

#

I thought I am supposed to do that

#

because the cross product

#

ehhh

#

those tangents should be the same and they are except for the w

#

oh actually the tangent is negated on the z too

#

this looks better

#

I want to see the tangents in blender

#

why I got a line like this I guess that's the next thing to look at

cloud rivet
#

blender tangent export is just garbage I think

#

I will look at MikkTSpace

#

The math error which occurs from this mismatch between the normal map baker and the pixel shader used for rendering results in shading seams. These are unwanted hard edges which become visible when the model is lit/shaded. They are a source of wasted time and frustration to an artist/designer.

#

yup

#

The implementation is designed, specifically, to make the generation of tangent space as resilient as possible to a 3D model being moved from one application to another. That is generate the same tangent spaces even if there is a change in index list(s), ordering of faces/vertices of a face, and/or the removal of degenerate primitives. Both triangles and quads are supported.

#

hrmmmm

dry apex
cloud rivet
# dry apex i gave up here lol

I think I am learning things right now, I was transforming my normals with my inverse transpose and normalizing the results but reading mittick code and lengyel I see they aren't doing that

#

and that already made it a tiny bit better

#

I still have that hard edge on the top half circle banners

#

I'm gonna try and go full lengyel with these findings

#

the rings of shame man

#

I'm gonna pause on this, I think I need the fancy lighting to better understand how the normal maps are doing stuff, I am just seeing the diffuse lighting right now

#

I think:

  1. My ingested tangents are correct, they are directly imported from blender
  2. My tangent space is correct now, it directly correlates to math I have found in three different sources.
  3. My asset to engine pipeline is sending all the correct values.
#

I feel like it looks better when I remove all my normalize calls in my lighting code

#

if these were my assets I would just fix the tangents

#

man my rendering doesn't look anything like

true moon
#

Make the shadows darker

cloud rivet
#

my flowers don't look anything like this either

cloud rivet
true moon
#

A lot of looking good is just the values, just like painting a picture

#

I.e. "art direction" in the gaming world

wraith urchin
#

AO would also add alot of detail

#

@cloud rivet my sponza tangents for reference

#

in viewspace

#

+z forward left handed

cloud rivet
#

oh same

#

except

#

you don't have those rings

#

how come you don't have those rings :(

#

like my circel banners have a hard edge down the middle

#

how did you get your tangents?

wraith urchin
#

I don't use the tangents from the file, I get my tangents from mikktspace

cloud rivet
#

I mean the comments are fantastic

wraith urchin
#

The comments should do it

#

deccer actually had a good example somewhere

#

for reference here is my sponza

cloud rivet
#

damn

#

looks incredible

wraith urchin
#

thanks froge_love

#

AO does alot of heavy lifting

#

without AO:

cloud rivet
#

we're all just posting the same picture over and over again KEKW

wraith urchin
cloud rivet
#

I used the one you linked

#

the khronos one

wraith urchin
#

the color of the drapes looks different

cloud rivet
#

uh could be a me doing something wrong issue

wraith urchin
#

Maybe I'm not using the khronos one lol

true moon
#

Intel one?

cloud rivet
#

so maybe I am just doing it wrong

#

oh

#

maybe it is different directions?

wraith urchin
#

Oh no I thing I'm just looking from the wrong side lmao

cloud rivet
#

yeah

wraith urchin
#

yeah it matches now lol KEKW

cloud rivet
#

so I just like

wraith urchin
cloud rivet
#

give one mesh at a time to mikkt?

wraith urchin
#

Damn it looks like deccer nuked the HowToScript repo

#

he had a decent mikktspace example in there

cloud rivet
#

oh wow

#

that must have been recent

#

I saw it like a few days ago

wraith urchin
#

regarding your rings, note that the texture only has one side of the pattern, this means there must be a UV seam running exactly along the ring

cloud rivet
wraith urchin
#

Are you sure you didn't mix up your tangents and bitangents?

cloud rivet
# wraith urchin Are you sure you didn't mix up your tangents and bitangents?

    float3 normal = v.normal;
    float3 tangent = v.tangent.xyz;
    float3 bitangent = cross(normal, tangent) * v.tangent.w;

    float3 view = sd.cameraPosition.xyz - v.position.xyz;
    view = float3(dot(tangent, view), dot(bitangent, view), dot(normal, view));

    float3 light = float3(dot(tangent, sd.sunlight.xyz), dot(bitangent, sd.sunlight.xyz), dot(normal, sd.sunlight.xyz));
#

^^ this is from lengyel

wraith urchin
#

yeah this is the shader, but how does that data get to the shader

cloud rivet
#

it looks the same with a matrix

#

just export from gltf

#

I don't modify it

wraith urchin
#

yeah but there is obviously code in between

cloud rivet
#

it's just writes std::array<float,N> and sends it to the gpu

#

it gets saved to disk that way, gets pulled out from disk the same way

#

I literally do no math on this, they stay std::array

wraith urchin
#

did you transform the normals & tangents by the object transform?

cloud rivet
#

no

#

lengyel's math doesn't do that

wraith urchin
#

you should lol, the 3x3 component

cloud rivet
#

if I do that it looks completely broken

#

no

astral hinge
#

I assume v contains world- or view-space vertex info already

cloud rivet
#

this is in tangent space

#

it's not in world space

#

yeah

#

my normals/tangents etc never go into world space

#

and nothing is being scaled or changed in any way

#

I think if I were doing any of that wrong more things woudl be broken besides those rings

wraith urchin
#

In the vertex buffer these vectors would be in object space

#

right?

#

you need to transform them into world space I think

#

actually can I just see your vertex shader?

#

the whole thing