#GrubStomper29's OpenGL Sandbox

1 messages ยท Page 7 of 1

plain mantle
#

mesh shaders? with OpenGL?

gilded shell
#

that exists, right?

plain mantle
#

Technically yes

#

but its actively in flux

#

AMD is adding some kind of extension

#

Nvidia already has one

gilded shell
#

yeah i use nv hardware

plain mantle
#

you do yeah

gilded shell
#

i thought some amd cards support GL_NV_mesh_shader

plain mantle
#

I'm not sure

gilded shell
#

theres a few cards on here

#

wait

#

im not seeing rtx 3050 on there ๐Ÿ˜…

#

oh nvm

#

its supported

#

yeah it looks like most modern cards support it

#

and its not like ill be having a wide audience with this project

#

iโ€™m hoping ill reach 10ms draw times with that optimization

#

i dont know if ill be able to get below that without lod, which i refuse to touch

gilded shell
#

screen space derivatives failing? check that red cloth thing I don't know the name of

plain mantle
#

The red thing is called an awning

#

Not sure about the derivatives

#

But you could really use some MSAA

gilded shell
#

once i have pbr i wouldnt mind trying out super sampling

#

@kind sparrow you havent said much in here recently

plain mantle
gilded shell
#

idealy id like to try TAA but it might be scope creep

junior sparrow
#

Yeah I know but in this case it should beat the index buffer generation + rendering

junior sparrow
gilded shell
#

i am violently against ai frame generation

junior sparrow
#

You can use it as TAA

gilded shell
#

ill see

#

todo try min max vectors for radius calc

plain mantle
gilded shell
#

oh ok

plain mantle
#

Dlss & fsr4 are

kind sparrow
#

I haven't done CSM before and I'm not that interested in Sponzas etc personally so I don't have much to say

#

It looks good though

gilded shell
#

fair enough

#

thanks!

kind sparrow
#

I'll be implementing CSM eventually too, might be a little while though

#

I'm currently on the audio bikeshed

gilded shell
#

yeah

night shoal
#

ja, sponza == boringue

gilded shell
#

hey, this is bistro

kind sparrow
#

Same thing

night shoal
#

both are also just hacked together, no sense of detail or craftmanship

kind sparrow
#

They're interesting ish but after the Nth time they lose their charm

#

No doubt they're good test scenes from a utilitarian perspective

night shoal
#

ye, after the nth time you see all the cracks

gilded shell
#

theyre simply the only good stress tests i know of available in gltf

#

id love to see more

echo token
#

you could ask vblanco for the godot test scene he mentioned

#

I have it somewhere too I think

gilded shell
#

alright I think I fixed shadow mapping matrix calc

#

there is some acne on the next cascade

gilded shell
#

i want to try dithering between cascades

plain mantle
gilded shell
#

how does the dithering work?

#

does the dither value decide what shadow map you sample?

plain mantle
#

I add the dither value to the distance before the cascade calculation

#

The dither value is between 0-1 so multiply it by the distance you want the transition to happen over

gilded shell
#

i see

plain mantle
#

What does your cascade selection look like in the shader?

gilded shell
#

very primitive lol

plain mantle
#

Ah yeah so it's a flat cutoff

#

You can get a little more resolution if you use a spherical cutoff

gilded shell
#

yeah but im lazy and its working fine for now

#

the dithering works good

#

albiet i am using a random dither function i found on reddit

#

lets see if yours is better

#

whats the difference between mod and fmodf

#

type specificity?

kind sparrow
#

do you mean modf

#

glsl doesn't have fmodf afaik

gilded shell
#

the article uses std::fmodf

#

cpp

kind sparrow
#

ah

#

you can look at cppreference then

gilded shell
#

anyways I just dropped in the code and replaced those calls with mod and it works just fine

gilded shell
gilded shell
#

i must say im pretty happy with that

#

I am still suffering with shadow acne at further cascades, so clearly I need to scale my bias accordingly

kind sparrow
#

modf*(float val, float* intPart) separates the fractional and integer parts of a float,

gilded shell
#

cppreference doesnt mention that afaik

kind sparrow
#

fmod*(float x, float y) performs a floating point division but returns the remainder left over from calculating a whole number quotient

#

they're two different things

gilded shell
#

I also got rid of the ugly transparent cubes bisecting the scene

gilded shell
kind sparrow
#

it's confusing but the variants of fmod are fmod, fmodf, fmodl, and the variants of modf are modf, modff, modfl

gilded shell
#

right lol

#

welp

#

shadow acnes gone

#

i guess im done?

gilded shell
#

I also finally have a thread thumbnail, even if it is very generic ๐Ÿ™‚

night shoal
#

im jealous ๐Ÿ™‚

gilded shell
night shoal
#

i have no shadows going yet ๐Ÿ™‚

#

or hiz meshletisms

gilded shell
#

oh i see

#

you can see my github and vkguide for hzb stuff

#

my hzb generation is really brute force (1 compute dispatch per mip level) but its surprisingly fast

#

i could probably interleave the different hzb dispatches to reduce the impact of stalling for the next mip level write

gilded shell
junior sparrow
#

daxa is calling

night shoal
#

nsight supports mesh shaders though

#

you can also ping BoyBayKiller in #opengl about them, if you need more info

gilded shell
#

0(3) : error C0203: extension GL_NV_mesh_shader not supported in profile gp5vp

#

not sure why this occurs

#

must I use a compatibility gl profile

night shoal
#

update your gpu drivers

gilded shell
#

i just did that last night

#

let me see

night shoal
#

what gpu and what os?

gilded shell
#

windows 11, rtx 3050

night shoal
#

weird

#

you need a core profile

gilded shell
#

hmm

night shoal
#

you cant use GL_NV_mesh_shader as an extension in a fragment shader

#

mesh and task shaders are completely new stages

gilded shell
#

oh yeah

#

I probably shouldnt be telling gl that its a vertex shader

plain mantle
#

that would do it

#

did you read the extension spec?

night shoal
gilded shell
#

not sure why this happens

#

figured it out

echo token
#

it's what I plan on doing next time I revisit this class ofp roblems

gilded shell
#

preferably but i dont think it works on opengl which is why i wrote my own

gilded shell
#

@night shoal if I were to creddit you for something, should I capitalize the D in your name?

#

or leave it how you wrote it

night shoal
#

its all lowercase

gilded shell
#

alright, thanks

#

oh no...

night shoal
#

update nsight

#

and c++ captures are finnicky

gilded shell
#

looks like what I used before is still there

#

regardless, nothing is rendering

#

here are the deccer cubes

#

obviously im suffering indexing errors of some sort

#

immediately found 1 ๐Ÿ™‚

#

looks like were only drawing 3 triangles per meshlet for some reason

#

YEAH BABY

night shoal
#

et voila

#

noice

gilded shell
#

bistro works too

#

for some reason visual studio is hiding my stop debugging button on some submenu

night shoal
#

f10

#

people who click on buttons to debug are very suspicious ๐Ÿ˜„

gilded shell
#

lol

#

i have materials and culling back

#

i still need blended objects and shadows

#

its still running real slow because mesh shader thread group size is 1, and im not yet doing anything to deduplicate vertex transforms

#

each cluster has a max of 64 verts but im transforming vertices per index, so really its closer to 372 vertex transforms per cluster bleakekw

#

easy fix though

night shoal
#

still, very cool

gilded shell
#

we still never found an explanation for that threadgroup quirk i found several months ago

#

where dispatching an 4x4x4 local size compute was much slower than 64x1x1

#

at least for the cluster batching

#

i should talk about that in general

spring kelp
echo token
#

and follow up question, can you easily remedy this by modifying it

spring kelp
#

The problem is for non power of 2 textures it will generate a hiz where the depth of a coarser mip is not the min/max of a finer mip

#

It can "miss" pixels

spring kelp
echo token
#

hm, I might have to dig around granite next time I need a hiz

#

seems kinda dumb though because if you could tolerate missing pixels, wouldn't you just not bother generating mips to begin with

spring kelp
#

It's only for non power of 2 textures

#

Hiz isn't spd's intended use case unfortunately

gilded shell
#

testing

#

looks like i cant send images right now

#

Neither via mobile or pc

kind sparrow
#

Discord is breaking down it seems

gilded shell
#

oh i thought it couldve been related to the things ive been sending friends for years

#

well thats fine, im not working on anything visual

#

by some luck for the past few months I always seem to have just enough padding already in a gl struct to be able to add some more attributes

#

for example just now i need to add 2 uints to my cluster struct, and by chance there are two ints oh padding

gilded shell
#

mesh shaders are effectively fully implemented and im still getting 30ms frametimes

#

it seems like the only thing ive accomplished is moving 60% of the load from the meshlet batcher to the mesh shaders

plain mantle
#

What does nsight say is the bottleneck?

gilded shell
#

nsight profiler? not sure itll profile gl mesh shaders but ill give it a try

plain mantle
#

What did it say before the mesh shaders

#

Gpu trace is what you want

gilded shell
#

yeah it looks like gpu trace isnt going to work for now

#

here were stats on the heavy meshlet batcher before my mesh shader impl

#

right now its closer to 11ms meaning the mesh shaders are ~20ms

#

it probably doesnt help that my local workgroup size is 1

plain mantle
gilded shell
#

welp

#

ill need to somehow divide the count parameter of the indirect mesh draw buffer by 32

#

maybe I can use some modulus in the batcher

#

but that will potentially leave me 31 meshlets less than I need

#

maybe the first meshlet of each view will add 2 instead of 1 to the buffer

#

and this will ofc give me a 32x reduction in atomicAdds in the batcher ๐Ÿ™‚

echo token
#

you can just use subgroup ops to get that 32x reduction as well

gilded shell
#

lemme think

echo token
#

there's a subgroupAdd-something-or-other that's basically perfect for prefix sum operations

gilded shell
#

ill keep that in mind

#

i believe that will lock my mesh shaders and batcher to the same threadgroup size

#

and I still need to track the index for cluster writes

echo token
#

you still get the index, the subgroup op uses magick to make sure that each thread gets its own unique value of the sum, and then you can just elect one thread with the ballot to atomicAdd it

gilded shell
#

man compute really isnt fun

plain mantle
#

I like compute lol

kind sparrow
#

Compute is type 2 fun

#

Sometimes type 3

#

But when you get everything working it's great

#

The main trick is that it's essential that you can contrive test cases that are manually readable

#

If you have 2,000,000 elements that are being shuffled around it's impossible to debug stuff

#

You want to have small test cases and you want to have the ability to dump and/or write any intermediate state of the buffers

#

Because any non determinism can't be debugged with a graphics debugger

echo token
#

what are the types of fun

kind sparrow
#

Type 2 is not very fun in the moment but fun in retrospect, serotonin fun

#

Type 3 fun isn't fun at all even in retrospect lol

#

Basically it's mindless fun, tough and challenging but rewarding fun, and not actually fun as a humorous 3rd tier

echo token
#

oh lol

kind sparrow
#

My foliage stuff ended up being borderline type 3 fun lmao because it literally took 6 months of banging my head on horrible nondeterministic issues and when I actually fixed it it was not really that satisfying lmao

#

Although it laid the groundwork for future work

gilded shell
#

its just been so finicky to me

#

if I can get each frame under 10ms itll be so worth

gilded shell
#

or am i rotting

kind sparrow
#

I assume he's just talking about doing operations on group local memory

gilded shell
#

im not finding "subgroupAdd" anywhere

kind sparrow
#

You just use a group shared variable and elect one thread to do all the global sync

fervent lantern
#

or Exclusive

gilded shell
#

this seems like a needless limitation

gilded shell
#

im looking for the formal doc

echo token
#

yes you can do it in opengl

kind sparrow
#

Or something more exotic

echo token
#

I'm talking about subgroup operations, because it sounds like something vaguely involving a prefix sum

#

ignore that it's vulkan, GL has the same ext

#

particularly subgroupExclusiveAdd

echo token
#

but the formal definition is the text files on their github

gilded shell
#

so whenever i do go about making a real game, iโ€™m going to be releasing it under my real name, which i dont really want associated with grubstomper29

#

to keep yall updated on development id have to make a private server

#

is that cool with yall?

#

specifically demon, deccer, lukasino, and jake

kind sparrow
#

sure

plain mantle
#

Yeah sure, why not

night shoal
#

i have no objections either

kind sparrow
#

You can probably make a lot of progress on a prototype before you have anything recognizable enough to warrant hiding though imo

#

Depending on the project

night shoal
#

and/or develop under another artificial name

#

StompGrub69 or something

gilded shell
#

eh

#

iโ€™ll let you guys know when the time comes

gilded shell
#

i think to solve the batching issue ill try and stall thread 0 until all the atomic ops are done, then divide the var by 32

#

i wonder if there are in-shader barriers?

#

looks like there is a function with no parameter or return, seems easy enough

#

i wonder if dividing the var will be ub though

#

i can probably do some atomicExchange magic

#

if clusterId == 0
memoryBarrier()
fetch index
set index to index/32

#

seems easy enough

echo token
#

yeah, also how badly do you fear missing out on maybe a couple hundred, couple thousand dollars max? If I ever actually publish anything it'll probably be for free and anonymous

#

especially since I'm a big fan of copyright infringement among other things

gilded shell
echo token
#

if you're not making money why pierce the veil

gilded shell
#

because itd be my lifes work and magnum opus so id prefer to take due credit

echo token
gilded shell
echo token
#

oh then yes, in shader barriers will work

#

quite literally barrier();

echo token
#

yeah, I've never thought about it that way lol

gilded shell
#

especially if it does become popular, i wouldnโ€™t want someone else claiming credit

echo token
#

I think there's ways around that even still though, like the guy that made yume nikki

gilded shell
#

perhaps

echo token
#

I think only a few businesses and media outlets know who he is

#

no average person

plain mantle
#

ASO isn't gonna be my opus hopefully

gilded shell
#

really if one person plays it and has fun iโ€™ll consider it a job well done

echo token
#

yeah I also try not to think about just how few games you can make in a human lifetime without help

gilded shell
#

i only really want to make one or two published games

#

i wonder if distributing a game without monetization would affect the price id have to pay for music licenses

#

ill cross that bridge when i get there

echo token
#

protip: if they can't find you, they can't sue you

gilded shell
#

iโ€™m a lawful citizen

plain mantle
#

I know you have it in you

gilded shell
#

yeah for sure

#

but there were some cool songs i wanted to cover

gilded shell
#

in the following weeks im going to try to refurbish my Wii, Godwilling

#

general maintenance + a shelling replacement for the second time

#

the original shell was yellowed and eroded beyond repair so i bought a 3rd party replacement, which ended up being terrible and didnt even fit itself

#

so now ive bought a bricked wii to steal the shelling

#

now that i think about it, im really just migrating all the boards and disk drive from my wii to the bricked one

#

also replacing thermal pads and the clock battery

#

if i can repair the other wiiโ€™s board/drive or whatever is broken, I might resell it, mod it, or do something with it

gilded shell
#

the Before These Crowded Streets album has the best drumming ive seen in a studio, both in skill and tone

#

aux percussion is also great here but is better in Crash by the same band

gilded shell
#

@echo token i believe it was you who recommended i ask vblanco for a test scene. He hasnโ€™t responded. Do you have it?

echo token
#

uhhh let me dig

#

I definitely have it becaus I generally don't lose/delete this kind of stuff, the question is where

night shoal
#

isnt it on vb's github somewhere, if not some linked google drive

#

vkguide should know where

echo token
#

if I could just remember what it was called...

#

unrelated wtf is E1M1

#

is this a system shock map?

#

why do I have this

#

I will tell you that I have like 4 different copies of bistro

night shoal
#

thats doom1

#

dethraid turned the wad into gltf a year ago or so

echo token
#

ah that's why

#

I can't find a link on vkguide

#

but this is it

fervent lantern
#

its in the vkguide repo

#

structure.glb

gilded shell
#

should be a solid alpha blend showcase too

gilded shell
#

one thing I've been confused about is whether the mesh shader outputs are per invocation or per work group

#

i think ill assome the former and find out the hard way

#

from the nv example:

 // the actual amount of primitives the workgroup outputs ( <= max_primitives)
  out uint gl_PrimitiveCountNV;
#

looks like the output is per workgroup, but that output is still confined by max_primitives

#

which is pretty low

#

i dont think a workgroup would be able to output more than 2 meshlets

#

not sure what to do in this case

#

I could try to spread a single meshlet accross several threads

#

each thread transforms ~2 vertices and writes out ~4 indices

junior sparrow
#

I have seen invocations == max vertices in one meshlet or half of the max vertices. So each thread fetches 2 positions and transforms it. Later writes 6 micro indices

gilded shell
#

i need to write 12 indices per invocation

#

given thread size of 32 and meshlet triangle count of 124

junior sparrow
gilded shell
#

idk if enough hw supports that

#

ill give it a shot if I can figure that out

junior sparrow
#

I would assume it's the same as compute the amount of threads per thread group

#

I use 64 threads in my engine

gilded shell
#

alright

#

mabye not

junior sparrow
#

What kind of bullshit is that

gilded shell
#

3050 lol

junior sparrow
#

I think it's some OpenGL limitation than hw one

#

๐Ÿ’€

gilded shell
#

yeah probably

#

i was gonna say gl_nv_mesh_shader sucks

#

anyways 32 seems to work well enough; this is so fast man

#

no lods or hw raster, yet i have bistro csm at 11ms (this is the most expensive camera angle I know of)

#

which equates to 90fps on my 3050

#

i can probably get more if I use subgroup atomic ops for the batcher and try interleaving hzb gen

#

i did not think mesh shaders would give me a 3x speed boost

plain mantle
#

Is this forward rendering?

gilded shell
#

I could alleviate this by interleaving the dispatches, i.e. gen mip 1 for each hzb then proceed to mip 2 for each, etc.

#

in practice im not sure the time saved would matter given pcie bandwidth

gilded shell
#

weird how there's gl_LocalInvocationIndex but not gl_GlobalInvocationIndex

#

so I have to manually ```uint clusterId =
gl_WorkGroupID.z * gl_NumWorkGroups.x * gl_NumWorkGroups.y +
gl_WorkGroupID.y * gl_NumWorkGroups.x +
gl_WorkGroupID.x;

clusterId = clusterId * 64 + gl_LocalInvocationIndex;```

#

i STILL need to fix alpha blend stuff though

#

the vkguide test scene draws pretty fast

#

cant say im a big fan of the scene; its not very colorful and indoor-ness prevents shadow mapping from doing anything cool

plain mantle
#

You need some other lighting

#

Do you have spot lights? those are easy to implement

gilded shell
#

nah iโ€™m good

gilded shell
#

also im doing an inverse + transpose in the vertex shader

#

I def could bake and store that

echo token
#

memory is your bottleneck much more frequently than calculations

#

I wouldn't be too worried about baking and storing relatively simple stuff like that

gilded shell
#

i see

#

thats why i dynamically calc tangents

#

idk why bevy tries to use screenspace derivatives when you can dynamically calc tangents in vertex shader

night shoal
#

you could ask Jasmine ๐Ÿ™‚

gilded shell
#

ahhh i cant find the article

#

let me paste my code

#

theres probably other ways to do it

echo token
#

it's gotta get there somehow

gilded shell
#

also im doing this in the frag shader for some reason

spring kelp
gilded shell
#

oh hold on

#

maybe?

#

i mean yeah its around 12 years old

#

whats the new algo look like

spring kelp
gilded shell
junior sparrow
#

Also it doesn't introduce errors as inverse transpose

gilded shell
plain mantle
#
{
    return 1.0 / vec3(dot(m[0], m[0]), dot(m[1], m[1]), dot(m[2], m[2]));
}```
#

you can then multiply the scale back into the matrix or simply apply it separately

#

so in my case mat3 rotation = mat3(local_transform); vec3 transformed_normal = rotation * (normal * extract_matrix_scale(rotation));

echo token
#

wouldn't you need to sqrt the columns?

#

I thought the scale was vec3(length(m[0]), length(m[1]), length(m[2]))

junior sparrow
#

The trick is called adjoint/adjogute matrix. It's a special case where inverse transpose isn't needed. I hope I spell the other word correctly KEKW

echo token
#

right the cofactor matrix

gilded shell
#

splendid

gilded shell
#

before

#

after?

#

trying out srgb

#

i think its fixed

#

I think it looks a lot nicer

#

but it could really use some hdr

gilded shell
#

I want good hdr but i dont want to go down a rabbit hole

night shoal
#

opengl doesnt really have colorspaceisms, all you got is tonemappers

#

vulkan supports the former natively

gilded shell
#

thats fine

night shoal
#

and i always thought you were on vulkan already

plain mantle
#

You can have one or the other

gilded shell
#

i though so

#

ill probably just throw in the simple logl sample and add controls for that in the gui

night shoal
#

you can probably stay away from the logl sample and throw in a mcmapperface in

gilded shell
#

sure

#

post is, imo, the lamest part of cg by far

kind sparrow
#

Makes a huge difference though

gilded shell
#

yeah

#

as much as id love retina based solutions thats probably the deepest rabbithole

kind sparrow
#

Retina?

gilded shell
#

eyeball receiver

#

iโ€™m probably not using correct nerdimology

kind sparrow
#

You mean like a physically based solution

#

the one true correctโ„ข tonemap

gilded shell
#

empirical would be fine for my case

#

i just want the image to look somewhat like youre viewing it through an eyeball

#

which i suppose means absolutely nothing since you already do that with every image

kind sparrow
#

I mean in principle you could have a completely physically based process that is designed to make the pixel the same color as whatever a spectrophotometer would report if you pointed it at that point

#

The problem is that your overall interpretation of the picture in real life is dependent on more than just one rod or cone

gilded shell
#

right

kind sparrow
#

there is not only automatic gain adjustment via pupil reflex and rhodopsin depletion but also filtering of patterns to do localized contrast leveling

gilded shell
#

right

#

is there a name for that approach to post processing?

kind sparrow
#

photometry

#

psychophotometry maybe

gilded shell
#

yeah

#

i wish more games explored that

#

i hate to see a first person game still try to look like a film camera

#

though id love to see a siggraph on this stuff its out of scope for this project

kind sparrow
#

Exhibit A

echo token
gilded shell
#

piss filter my beloved

gilded shell
#

||test||

west trail
#

||Someone discovered spoilerfrekw ||

gilded shell
#

had to discuss a show i watched and really like

#

called neon genesis evangelion

gilded shell
#

i think ill just use Reinhard Extended for tonemapping

plain mantle
#

So when are you writing a wii game?

night shoal
#

right after releaseing the Bistro DLC for Metal Gear Liquid Solid

gilded shell
#

ive had such a project in mind for over a year now

#

not a wii game but gc/wii accurate graphics

gilded shell
#

Here's reinhard extended tonemapping

#

using luma instead of color for calculation ๐Ÿ™‚

#

im also trying to find more accurate sunlight and sky colors but without using real world units, im not sure if its possible

night shoal
#

you need to show some others side by side

#

otherwise i have no idea if reinhard is something cool or not ๐Ÿ™‚

gilded shell
#

it fits my needs: I just set a value to the max possible luminance and it maps the scenes colors accordingly

#

thanks brave

#

heres something

#

im not sure how color temperature relates to the strength of a light

night shoal
#

wikipedia probably describes all those terms

#

luminance, magnitude, flux, etc

#

and their relationship, candela/lux/lumen

gilded shell
#

I like this for now. I'll probably use that paper when I impl pbr

kind sparrow
#

Otherwise you'd need some other description of arbitrary spectral content

#

Black body radiation just happens to be a convenient one

#

Since the sun and a variety of other light sources are approximate black bodies (any thermal light source basically, like an incandescent bulb)

gilded shell
#

i see

kind sparrow
#

It's completely unrelated to strength

gilded shell
#

then i imagine id need some unit of strength for sunlight

kind sparrow
#

Yes

#

Radiance

gilded shell
#

radiance

kind sparrow
#

This is a major rabbithole though

gilded shell
#

yikes

kind sparrow
#

I imagine you haven't taken vector calculus yet

gilded shell
#

nope

kind sparrow
#

And the units of radiometry are confusing as hell

gilded shell
#

for sure

#

and iโ€™m not sure how id fit it into my lighting pipeline

kind sparrow
#

You'd use physical units for all your values

gilded shell
#

that doesnโ€™t sound very fun

kind sparrow
#

Such and such watts per square meter, so many watts per steradian per sq meter etc

gilded shell
#

lol

#

really im looking for a ratio of sunlight radiance to sky radiance, the latter being used as ambient light

#

i think right now I have it at 4:1

kind sparrow
#

According to wiki it's ~15%

#

Actually 20% when you remove the outscattered sunlight from the direct lighting

#

So 5:1 is a good estimate

gilded shell
kind sparrow
#

Diffuse sky radiation is solar radiation reaching the Earth's surface after having been scattered from the direct solar beam by molecules or particulates in the atmosphere. It is also called sky radiation, the determinative process for changing the colors of the sky. Approximately 23% of direct incident radiation of total sunlight is removed fr...

gilded shell
#

and im assuming this depends on time of day? I think Iโ€™m shooting for 3:00 pm on this scene

kind sparrow
#

Yeah it does

gilded shell
#

im sure 3 is close enough to noon

kind sparrow
#

There's a formula lower down for calculating it depending on incident angle it seems

gilded shell
#

ah yeah i wouldnt mind simple simulation

#

i think my shadow angle is probably too extreme for 3:00

gilded shell
#

im actually having a lot of trouble finding a ggx brdf impl

#

i might just use Cook-Torrance

#

man google and brave are being so useless right now im getting a headache

night shoal
#

try filament or adobe's materialx

gilded shell
kind sparrow
#

You just have to post the spicy memes in your project thread where the mods aren't looking

gilded shell
#

lol

#

I really love when code examples use single lettered variables

plain mantle
#

Did I miss a spicy meme?

gilded shell
#

just some screenshots of funny things I see on the roblox shop

#

I wonder why the lambertian is formatted this way? Why not just dot the surfacae and light normal

echo token
#

because it's meant to plug into the render equation

#

which has cos(w_i) baked into the definition

#

also because the render equation is defined as an integral over the surface area of a unit sphere it leaves you with a 4pi you need to divide off

gilded shell
gilded shell
kind sparrow
#

4ฯ€ steradians cover the whole sphere

#

Idk what the normalization is for in this specific case though

gilded shell
#

right now Im just using the brdf for direct light

#

it was my understanding you could just multiply the brdf output by the light-frag cosine and use that

gilded shell
#

Is there any reason to not use a GL_RG16F framebuffer attachment to store deferred metallic roughness data?

kind sparrow
#

Do you need floats to describe that

gilded shell
#

whats the alternative?

kind sparrow
#

unorm

#

What's the range of your metallic roughness values

gilded shell
#

0 to 1

#

so i suppose

#

why not use unorm for my color framebuffer too

#

are they ints? reading the spec rn

gilded shell
# kind sparrow unorm

I dont think so. unorm looks like integers? GLTF spec says metal and roughness are floats

#

...or maybe I can. This is written pretty confusingly:
Unsigned normalized integers store floating-point values on the range [0, 1]

kind sparrow
#

Unorm is what regular texture components are

kind sparrow
gilded shell
kind sparrow
#

Floating point values are for if you want your texture to store values like 3e-4 or 5.1e6 etc

#

Which is not usually, unless you're doing PBR lighting stuff with high dynamic range values like with physical units

gilded shell
#

not in the deferred buffers

#

yet I used rgba16f for them

#

probably way overkill

echo token
#

also I don't entirely know why lambertian is defined as C/pi when the total surface area is 4pi, I dunno where the 4 gets lost

gilded shell
#

either im reading materials wrong

#

or this bistro model doesnt have proper metallicroughness materials

junior sparrow
#

You are getting in quite a Rabbit hole with PBR

echo token
gilded shell
#

i forgot to tell yall that nsight is completely broken for this project right now

#

probably due to mesh shaders

night shoal
#

nsight supports mesh shaders

gilded shell
#

not gl

night shoal
#

of course gl

#

mesh shader is nv tech

gilded shell
#

nah

#

whenever i try to capture debug info, theres a message like โ€œunsupported function detected: glDrawMeshTasksโ€

gilded shell
#

why

#

I also love that its called "metallicRoughness" and they put roughness before metalness

#

very nice

echo token
#

it's also in the gb channels

#

so r and a can be used for... something else

#

I don't remember what exactly but if you dig around for what's speced to the r and a channels you might see what they expect as an "optimization"

gilded shell
#

I didn't see it

#

oh well

gilded shell
#

im just gonna flip it in shaders

#

looks like all my metallicRoughness vals are 1, 1

#

i think its an issue with the model

#

ill try the one yall posted above

#

7zip my beloved

#

@echo token mightve asked this already but do you have a project thread I can follow

gilded shell
night shoal
#

you need to enable the extension which is required by that model, most likely some glossiness roughness thing

#

KHR_materials_pbrSpecularGlossiness perhaps

#
    constexpr auto parserOptions =
        fastgltf::Extensions::EXT_mesh_gpu_instancing |
        fastgltf::Extensions::KHR_mesh_quantization |
        fastgltf::Extensions::EXT_meshopt_compression |
        fastgltf::Extensions::KHR_lights_punctual |
        fastgltf::Extensions::EXT_texture_webp |
        fastgltf::Extensions::KHR_texture_transform |
        fastgltf::Extensions::KHR_texture_basisu |
        fastgltf::Extensions::MSFT_texture_dds |
        fastgltf::Extensions::KHR_materials_pbrSpecularGlossiness |
        fastgltf::Extensions::KHR_materials_specular |
        fastgltf::Extensions::KHR_materials_ior |
        fastgltf::Extensions::KHR_materials_iridescence |
        fastgltf::Extensions::KHR_materials_volume |
        fastgltf::Extensions::KHR_materials_transmission |
        fastgltf::Extensions::KHR_materials_clearcoat |
        fastgltf::Extensions::KHR_materials_emissive_strength |
        fastgltf::Extensions::KHR_materials_sheen |
        fastgltf::Extensions::KHR_draco_mesh_compression |
        fastgltf::Extensions::KHR_materials_unlit;
    fastgltf::Parser parser(parserOptions);
#

fastgltf should also tell you why it wasnt able to load

gilded shell
#

domeboy mentioned texture compression

night shoal
#

just look at the error in loadresult

echo token
gilded shell
#

Ah

#

I love you domeboy but text rendering is so uninteresting to me

echo token
#

though I had a feeling you might be interested since what I do when I feel like working on it is usually copying roblox features

#

yeah it is boring by most metrics, my engine UI is just basically roblox UI so that lib is basically what I needed to drive feature compliance with all their various things

gilded shell
#

i see

#

i think i might go back to sponza rendering for now. Iโ€™m sure those materials work

#

better yet, i should probably use a pbr test model for this

echo token
#

there's the gltf one from "this mesh will also crash your engine"

#

it's a grid of spheres

#

I don't remember where that thread was though, much less how to necro it

#

glad so much of my long term memory is reserved for where I acquired GP test models from

night shoal
#

its in #experiments

gilded shell
#

i wonder what level of hearing loss this would induce

#

i sure hope he had ear pro on

#

especially around 2:39

kind sparrow
#

There are two types of musicians, ones that protect their hearing and ones that are halfway deaf lol

#

I always wore earpro while playing and I still have mild hearing loss on the right side from the china cymbal

#

It's not noticeable or anything since my hearing is very good but it's just "merely" normal on that side vs. the left where I have a few dB higher sensitivity than average, and I have mild tinnitus on the right

gilded shell
#

i see lol

gilded shell
#

alright so this is really hard to see but im writing the roughness and metallic as R and G here

#

and as you can see, it doesn't look right

night shoal
#

that looks familiar ๐Ÿ™‚

gilded shell
#

yeah but i wish it worked

#

i have no clue whats wrong with the metallic roughness textures

echo token
#

if they're uniform, maybe it depends on the values in the material definition in the glTF file?

gilded shell
#

heres the GL side

#

the whole thing is metal and rough?

echo token
#

it says there you have 1 met, 1 rough and no texture

#

so yes I guess so

gilded shell
#

that doesnt seem right

#

thats the only material and its over the entire model

#

and I may be wrong, but this looks a lot like a metal roughness texture

#

must be an issue with my loader

echo token
#

yeah

#

are you using fastgltf

gilded shell
#

yeah

echo token
#

are you checking for the PBR sub-struct in the material

gilded shell
#

I believe so

#

let me check

#
if (asset->materials[i].pbrData.metallicRoughnessTexture)
{
    hasMetallicRoughnessTexture = true;

    metallicRoughnessTexture =
        asset->materials[i].pbrData.metallicRoughnessTexture.value().textureIndex;

    metallicRoughnessTexture = mTextures[metallicRoughnessTexture].bindlessHandle;
}```
#

oh wow

#

it looks like i just skip those in the final struct init

#

thanks old me

#

this is a lot more like it

night shoal
#

this helmet doesnt store AO in the .r channel, so that should literally just be blue and green

#

there should not be a red

gilded shell
#

im doing some weird deferred junk, dw ab it

night shoal
#

ah

#

also

#

since you use bindless textures, you dont need separate hasXXX flags

#

you can just check if the address is 0 or not

gilded shell
#

is 0 reserved or something

night shoal
#

for what?

gilded shell
#

bindless handles?

night shoal
#

no

#

0 = no valid handle

gilded shell
#

i see

#

i wonder if thatll help with cache

#

ill fix that later

night shoal
#

just removes unnecessary code

echo token
#

I have my 0th bindless texture as my default black texture to be safe

gilded shell
#

this is new

echo token
#

I have handles 0, 1, and 2 reserved for black, white, and normal (0.5, 0.5, 1) respectively

#

very handy

#

if it's negative it sounds like an initialization issue

night shoal
#

opengl handles being 0 results in black by default ๐Ÿ™‚

echo token
#

also make sure to respect the optionals in fastgltf

night shoal
gilded shell
#

already on that

night shoal
#

ah

gilded shell
#

ah yeah i have no alpha blend geometry so the engine tries to make a buffer to store all zero alpha blend indices

#

this is clearly outline in the README as a feature

#

anyways this is a bit less nice

gilded shell
#

yeah idk ab this one

gilded shell
#

ill just use vec

night shoal
#

vec is float, uvec is uint

gilded shell
#

some fixes

#

its still broken btw

night shoal
#

is srgb on?

gilded shell
#

removing the specular denominator seems to get me closer for some reason

#

the filament paper doesnt seem to have it either

night shoal
#

are you loading albedo/metal/roughness as srgb too?

gilded shell
#

just albedo

night shoal
#

ah pic just loaded in

gilded shell
#

my main issue is fresnel seems to take over when I get too close

night shoal
#

i had metalness and roughness swappen in between somewhere before, make sure you didnt do the same mistake

gilded shell
#

thats not it

#

i wish the filament paper showed me more of the brdf

night shoal
#

the fresnel part shouldnt be visible when you look straight on to the object

#

it manifests at grazing angelos

gilded shell
#

im not sure what im missing

night shoal
#

render out the individual things as color

gilded shell
#

heres the brdf ```
vec3 brdf(vec3 v, vec3 l, vec3 n, vec3 f0, vec3 baseColor, float metallic, float perceptualRoughness)
{
vec3 diffuseColor = (1.0f - metallic) * baseColor;

vec3 h = normalize(v + l);

float NoV = abs(dot(n, v)) + 1e-5;
float NoL = clamp(dot(n, l), 0.0, 1.0);
float NoH = clamp(dot(n, h), 0.0, 1.0);
float LoH = clamp(dot(l, h), 0.0, 1.0);

// perceptually linear roughness to roughness (see parameterization)
float roughness = perceptualRoughness * perceptualRoughness;

float D = D_GGX(NoH, roughness);
vec3  F = F_Schlick(LoH, f0);
float V = V_SmithGGXCorrelated(NoV, NoL, roughness);

// specular BRDF
vec3 Fr = ((D * V) * F);
Fr /= (4.0f * max(dot(n, v), 0.0f) * max(dot(n, l), 0.0f) + 0.00001f) ;

// diffuse BRDF
vec3 Fd = diffuseColor * Fd_Lambert();

return Fr + Fd;

}```

night shoal
#

albedo only, metal only, roughness only, diffuse only, specular only etc

gilded shell
#

its def the specular calc

night shoal
#

NoV and max(dot(n, v), 0) looks like a duplicate

gilded shell
#

true

night shoal
#

NoL too

gilded shell
#

yeah

#

something about that seemed to do it

#

now onto bistro

#

again, idk if the materials are correct but im pretty sure brick walls dont have much fresnel specular

night shoal
#

i had very shiny surfaces too before

#

because i fucked up metalness and roughness

#

double check that, just in case

gilded shell
#

yeah I think its an engine issue if even sponza has this problem

night shoal
#

it always is a PEBKAC

gilded shell
night shoal
#

: (

#

problem exists between keyboard and chair

gilded shell
#

ah

#

yeah

gilded shell
#

has anyone figured out how to render foliage this thick yet

kind sparrow
gilded shell
#

thatd be the dream huh

kind sparrow
#

I have the makings of what could be basically nanite specialized for plants

#

but it's like multiple man-years away from being that mature

#

I would need to literally hire a professional team

#

the other issue is that a lot of the complexity you see comes from the infinite variability of the plants, in a game you need to reuse assets or the plants in this picture would be like gigs of data

#

but you could probably get close with the right pipeline

gilded shell
kind sparrow
#

It's basically just a graph representation of the plants that could be used for dynamically generated LODs while allowing arbitrarily complicated plants

#

but the actual infrastructure required to scale it to the level of generality and performance necessary to render a scene like yours is immense

#

also it would require my plant simulator to get way more advanced to be able to generate that scene in the first place

gilded shell
#

yeah

#

you should write a paper

kind sparrow
#

If someone gave me half a million dollars to quit my job and hire a few collaborators for a year or two I probably could

gilded shell
#

lol

plain mantle
kind sparrow
#

if only

gilded shell
#

i think the foliage would just be so hard to cull

#

too many โ€œholesโ€ in a plant to offer good occlusion of plants behind it

#

hzb culling would probably do something but not enough

#

i also imagine a need for imposters, but like demon said, keeping imposters for each unique plant sounds like a huge memory hog

#

then theres lod popping

#

problems exist to be solved ๐Ÿ’ฏ

plain mantle
#

Yeah foliage pretty much guarantees overdraw

gilded shell
#

putting dense foliage on procedural terrain sounds fun

#

iโ€™ll add that to the long list of potential projects

gilded shell
# gilded shell

as a plus, so much light is scattered from the canopy and fog of the Appalachians that shadows dont seem to be much of a thing

gilded shell
#

@kind sparrow can you confirm or deny this

kind sparrow
#

it's !fun!

gilded shell
#

welp, iโ€™m sure theres a lib for it somewhere

#

i can rip yours

kind sparrow
#

There isn't

#

there are probably some people's various experiments but idk if there's anything up to the task of real general-purpose plant simulation

#

Part of the problem is that modeling plant growth habits is real hard

#

it's very difficult to match observation to a model

#

for me anyways

#

I spent 6 months straight studying algorithmic botany and didn't get to the point where I could look at a plant and figure out its growth patterns

gilded shell
#

yikes

#

ferns tend to look uniform

#

100 billion ferns

#

take it or leave it

kind sparrow
#

I started messing with fern models but part of the problem is that kind of plant's morphology is heavily governed by physics

#

with trees you can sort of get away with treating them as perfectly rigid

gilded shell
#

im not terribly worried with trees atm

kind sparrow
#

but a fern needs to bend under the weight of its leaves

#

trees are the easy part though

#

everything else is hard because it's flexible

gilded shell
#

yeah

kind sparrow
#

and its growth patterns are in some ways even more context-sensitive

gilded shell
#

iโ€™m looking at the various ivies and leaves

kind sparrow
#

so you end up needing structural dynamics models and sensory processes and approximations of the behaviors plants use to decide which direction to grow

gilded shell
#

i wonder if cutting corners to make a rudimentary approximation is practical, hoping the density of the scene would mask the cracks

#

or would it be much like using broken bricks to build a castle

kind sparrow
#

that's sort of what I'm hoping

#

I burnt out on it though

gilded shell
#

yeah

#

i can see why ๐Ÿ’€

kind sparrow
#

I spent 6 months studying books and doing field observation and then it took another 6 months just to get my basic GPU culling/instancing stuff working so I just shelved it as-is as soon as it worked and haven't gone back

#

it's probably well poised to make more improvements quickly but I don't have the interest atm

#

maybe later

gilded shell
#

for sure

gilded shell
#

so maybe i do it for the heritage

night shoal
echo token
#

unfortunately in order to afford the salary we had to diversify into guano collection

plain mantle
ornate moss
gilded shell
#

@kind sparrow i was watching a movie and a character in it held his pistol weird, with his non dominant elbow above the slide like so

#

is this hollywood shenanigans or something esoteric

kind sparrow
#

Not sure

#

Possibly some defense against someone grabbing the gun

echo token
#

it seems like a weird hollywood interpretation of when you usually see guys stabilize their gun with their elbow below (also usually that's when they're also holding a flashlight, so it naturally faces forward)

gilded shell
#

the gunman in question was apprehending someone

#

that being said its Michael Bay so you never know

echo token
#

usually your best defense against someone grabbing your gun while you're aiming it is to pull the trigger

gilded shell
#

theres more missing context

#

the movie is The Rock and i enjoyed it

gilded shell
#

idk if i told yall but a few years ago i showed my friends a color interpolated square i made in vulkan

#

like the hello triangle but a rectangle

#

and I told them it took me two weeks to make so its been referred to as the 2 Week Box since

#

one of my friends made it his wallpaper too lol

night shoal
gilded shell
gilded shell
#

back to my program, you can see strong specular reflection on rough surfaces at grazing angles

#

Filament article says

#

so maybe its correct

junior sparrow
#

Came up with a nice way to handle backfacing normals for PBR. When NdotV < 0, rotate N to V so that NdotV == 0. This prevents issues with negative NdoV (Fireflies) and preserves relation between N and V. Alternative reflect method produces dark edges and loses edge detail:

#

try this

#

@gilded shell

gilded shell
#

I already clamp such vals

gilded shell
#

well this certainly isnt a grazing angle so its probably not correct lol

junior sparrow
#

๐Ÿ’€

gilded shell
#

odd how filament uses vec3 as fresnel return

junior sparrow
#

its because of the metals

gilded shell
#

yeah my mistake

#

I wish they included the specular denominator

#

anyways I dropped in the opengl functions as quick replacements for the filament ones

#

now it looks a little lame lol

#

it makes me think filament is doing something different for the specular denominator

#

which is a shame since there's no code example for it. It might be buried in the explanations somewhere.

gilded shell
night shoal
gilded shell
#

Why is float NoV = abs(dot(n, v)) + 1e-5; when the other dot calcs clamp and omit the addition?

gilded shell
#

I wonder if theyre just omitting it

#

or they've replaced it with "pixel.energyCompensation"

#

idk what gives but dropping it seems to give correct results

#

i have no clue why the aliasing is like that one the edges of the model, thats really weird

night shoal
gilded shell
#

now im really curious about this

#

the filament cook-torrence impl doesnt have the specular denominator

gilded shell
#

I might implement RSM

#

i still probably need ibl for specular light though

gilded shell
# gilded shell

im still really confused why the outside edges are way more pixely than other geometric edges

#

i dont have any aa

night shoal
# gilded shell

if you are referring to this one, it just looks like you are rendering into a low resolution render target perchance

night shoal
#

wdym wdym

#

it looks like this is rendered into a 256x256 or something texture

#

rather than a 1080p one

gilded shell
#

I'm still getting used to android

#

I just switched from ios

#

idk what to put on my homescreen so i just have nothing

#

(the wallpaper is a picture i took)

#

if you guys have tips for smoother android usage or helpful settings id love to hear it

kind sparrow
#

Idk you don't have to do much

plain mantle
gilded shell
#

Well now that i have android i can play cave story on my phone

gilded shell
#

I replaced most of the google apps with othet stuff

#

but theres no replacing google maps

#

and for some reason my investing app needs google play installed and enabled

junior sparrow
#

Most apps use google services for security reasons

#

Graphene OS had some beef with companies about this bs

junior sparrow
gilded shell
#

transcribed part of a song by ear

#

it sounds a bit off, probably beacuse im not trying hard enough to stay on key

#

@plain mantle

#

its crazy how much better I am at the drum composition than anything else lol

plain mantle
gilded shell
#

at 0:40

plain mantle
#

I shoulda guessed it was DMB

gilded shell
#

lol

#

I probably didnt do enough with the bass

plain mantle
#

I dunno the bass part sounds pretty close to the recording

#

hes not going wild

gilded shell
#

but hes not playing the same note for 16ths

#

he dances around a bit

#

regardless, its too late; trial FL wont let me open the file again so this is what we have lol

#

but yeah I wonder if doing little transcriptions like these will be beneficial

plain mantle
gilded shell
#

what about creativity for composition

plain mantle
#

Best way to get better at composing is to compose

gilded shell
#

i see

#

I think these are solid baby steps

plain mantle
#

You will inevitably make some stuff that doesn't sound great, but eventually you will have something that sounds good. And you can choose to only show us the good stuff ๐Ÿ˜‰

gilded shell
#

yeah

#

anything but programming

#

ive been putting off ibl

gilded shell
gilded shell
#

I forgot to tell you all; I got a 5 (best possible score) on the ap calculus exam

plain mantle
#

Congratulations!

gilded shell
#

i think i wanna hold off on vk forest scene 2

#

and instead make a basic game first, mostly to learn better engine structure

#

frog platformer or smth like that

plain mantle
#

Yuss! Do frogge platformer!

#

Is it gonna be gamecube styled?

gilded shell
#

you know me so well

plain mantle
#

Like mario sunshine type stuff?

gilded shell
#

perhaps

#

do you all have scenegraph impls?

kind sparrow
#

No

#

Depending on what you mean

plain mantle
#

Same

#

I just loop through everything with a mesh component and draw it

#

Highly recommend EnTT btw

kind sparrow
#

Yeah and I just have a specific component and system to handle parent/child spatial relationships

plain mantle
#

I have like 12 different components for that KEKW

#

Like I've said before ASO is a DAG

gilded shell
#

I see

gilded shell
kind sparrow
#

It just makes it easy

#

Your own would basically do the same thing

#

If your game is going to be simple you can roll your own easily entt is just convenient

echo token
#

yeah its not worth rolling your own tbh

#

I did and eventually just switched back to entt because maintaining a lesser featureset just wasn't worth it

night shoal
#

demons nih rolled one is also sufficient enough, but i also stick with entt

kind sparrow
#

If your game has a known finite scope you can just use flat static arrays of size MAX_ENTS which is easy

#

That's my NIH one

#

But if your requirements are basically any bit more complex it's worth just using entt

night shoal
#

yeah

#

perhaps if you have hundreds or thousands of entities then entt's group-thing might be a better choice

#

i also dont want macro-isms ๐Ÿ˜›

kind sparrow
#

Mine only uses macros to define the types

#

After that it's macro-free

night shoal
#

yeah

#

hence the ๐Ÿ˜›

kind sparrow
#

Deccer you need to learn to become based and macropilled

#

Macros are great when used judiciously

plain mantle
kind sparrow
#

Don't slander me

#

He's referring to my minimal_game ECS impl

gilded shell
#

ive never macrod

#

my code is perfect and doesnt need changed on the fly

kind sparrow
#

macros are for when you have a pattern that would result in copy/pasted code that's either not worth abstracting or not possible to (e.g. in the case of declaring named static arrays)

#

It's rare to need them but when they are the right tool they are super useful as long as you don't abuse them

gilded shell
#

yeah

#

i definitely havent rewritten the same functionality multiple times across different glsl files

kind sparrow
#

stb_include is your friend on that front

gilded shell
#

does anyone know good resources on shoreline water rendering

#

as shown in this fine chap's video

echo token
#

there's an article from assassins creed which is decent

#

the one before black flag

gilded shell
#

ive been had

#

I'm seeing instagram ads based on some research i did earlier today

#

likely because some of it was on youtube

plain mantle
#

Yeah trackers

#

Not using adblock I see

gilded shell
#

i havent found a good one for android

#

are you referring to dns, vpn, or something else

plain mantle
#

No just the browser plugin

#

Ads that are embedded into sites usually contain trackers

#

So that when you go to another site that also serves ads.

#

It remembers you

#

Of course this won't stop the instagram app from tracking you

gilded shell
#

ofc but im not quite willing to give it up just yet

plain mantle
#

I hate instagram. But unfortunately I need it

echo token
#

do you get a significant follower base from instagram

gilded shell
#

Not at all

plain mantle
gilded shell
#

i just use it for acceletating my dementia and communicating with friends

plain mantle
echo token
#

it has booted into gui mode for me

gilded shell
#

nor do i post anything anywhere but github

plain mantle
kind sparrow
#

We just got called millennials growing up because nobody knew what gen Z was yet

plain mantle
kind sparrow
#

Haha

echo token
#

yeah I am very glad to not be a millenial

plain mantle
#

I am very glad to be one

night shoal
kind sparrow
#

No lol

night shoal
#

then DR is a millenial too ๐Ÿ˜›

kind sparrow
#

We are all gen Z

#

You're thinking of gen alpha

#

We're just old gen Z

night shoal