#Fwog and co.

1 messages · Page 2 of 1

long robin
#

lol I accidentally committed this line from testing
auto joe = Fwog::ClearColorValue(1, 2, 3);

long robin
#

btw I'm thinking of typed textures

#

it would be maybe useful to separate color textures and depth/stencil textures

heavy cipher
#

how would it look like?

long robin
#

I'm still thinking about it

heavy cipher
#

perhaps it will come to you in a dream

long robin
#

maybe typed texture views I guess

heavy cipher
#

but yeah, could be worthwhile

#

Tear has been asking for typed buffers for a while now

#

similar boat

long robin
#

I was looking at my render target struct and realized that it's pointless to combine color render targets and depth/stencil render targets as the same struct

#

and it just makes things more complicated with union shit

#

I also realized that, since you often know if it's a color or depth/stencil texture at compile time, these could be separate types

#

there would be a few places that could benefit from the additional type safety

#

the only case I see for super duper typed textures like Texture<RGBA8_UNORM> is for uploading data and idk if it's worth it

#

at the same time, buffers are written to often enough that I can see the benefit for those

#

oh wait I already added typed buffers KEKW

#

it would also be really nice to not have to interact with std::variant<std::array<float, 4>, std::array<uint32_t, 4>, std::array<int32_t, 4>> data; when I'm clearing a texture

#

the fact that depth and stencil are sometimes separate and sometimes one thing is really annoying

long robin
#

ok I just had a brainworm

long robin
heavy cipher
#

#pragma region to the rescue

long robin
#

I could just secretly check the texture's type and convert from the variant's type to the one needed to clear the texture. Or just assert if it doesn't match (which is what I currently do)

heavy cipher
#

very secret, very cool

long robin
#

I feel like a secret conversion would lead to subtle bugs in some cases where you're clearing to a nonzero value

heavy cipher
#

eg. maybe you have quality settings

long robin
#

yea

#

but my theoretical plan wasn't to force the usage of those

#

just have them derive from Texture and then add extra safety on top

heavy cipher
#

as a treat

long robin
#

clang-format did a number on this one

heavy cipher
#

smh rejects my gpu powered std string

#

is mapping raii?

long robin
#

hmm, that reinterpret_cast could be a static_cast

long robin
#

good idea though, will add issue

#

I do assert if the buffer is still mapped at destruction time, so I guess that counts for something

heavy cipher
#

3 pieces of reddit silver

long robin
#

idk how exactly I should design the RAII thing returned by mapping

#

maybe it should have move semantics if I want to change the lifetime of the mapping?

#

but std::lock_guard doesn't offer move semantics (and probably for good)

heavy cipher
#

why'd you put a lock in there?

long robin
#

lol sry that was just for comparison

#

they are kinda similar in some ways

#

I was mainly thinking of edge cases from normal mapping, like mapping once at the start of the program

heavy cipher
#

normal mapping nervous

long robin
#

because the lifetime needs to be elongated in the case of persistent mapping

#

eh or I could just offer both unsafe and scoped mapping as a cop-out

heavy cipher
#

depending on dependent things, you can do what is idiomatic in vk

#

persistent maps for some things on creation

#

no other mapping, no explicit mapping and unmapping

long robin
#

so two options basically

#

maybe my cop-out isn't a cop-out

heavy cipher
#

its a cop movie

#

i am not sure intermittent mapping is worthwhile

#

i think subdata is better for that on some drivers

long robin
#

ye

#

so I guess the only purpose of mapping now would be for some persistent mapped thing, or for reading the data

#

but for reading I can just use glGetBufferSubData all the same

#

so really just persistent mapping is the compelling use case

#

then I guess unmapping in the buffer destructor is fine. I can't think of a reason you'd want to explicitly unmap a persistently-mapped pointer

#

maybe some drivers put persistently mapped buffers in some small region of memory?

heavy cipher
long robin
#

I sure do love how easy it is to be certain with opengl

#

almost makes me wish for a nuclear winter

heavy cipher
#

i used to be a cpp enjoyer like you
then i took an operator-> to the knee

shell inlet
#

at least not an std

long robin
#

knee stds nervous

shell inlet
#

cpp has lots of stds, who knows maybe they'll add std::knee in C++30

long robin
#

I just realized @golden schooner isn't in this thread for some reason

#

nvm I'm just blind KEKW

golden schooner
#

was i supposed to comment on something?

long robin
#

No, I just thought you weren't here for some reason

#

I didn't want you to miss out

dire badge
#

I don't need any template stuff at all for my buffers / textures

#

oh wait, buffer has map which returns span<T>

long robin
#

returning a span is a good idea

long robin
#

this is depressing to read (this is in the opengl3 imgui backend in the repo)
https://github.com/ocornut/imgui/issues/4468

// Upload vertex/index buffers
// - On Intel windows drivers we got reports that regular glBufferData() led to accumulating leaks when using multi-viewports, so we started using orphaning + glBufferSubData(). (See https://github.com/ocornut/imgui/issues/4468)
// - On NVIDIA drivers we got reports that using orphaning + glBufferSubData() led to glitches when using multi-viewports.
// - OpenGL drivers are in a very sorry state in 2022, for now we are switching code path based on vendors.
#

at least the Intel driver bug was apparently fixed, according to the author of the issue

#

||8 days ago 💀||

brisk narwhal
#

OpenGL drivers are in a very sorry state in 2022
yesvidia

long robin
#

ye funny how AMD isn't on that

#

must mean AMD has the best OpenGL drivers 💪

brisk narwhal
#

Just move onto Vulkan and forget about all the OpenGL

#

it was all just a bad dream

#

it's over now

long robin
#

maybe someday

shell inlet
#

when the promise that all old devices will get vulkan support be fulfilled (never)

long robin
#

actually, I don't care about old devices

heavy cipher
#

fwog on zink

long robin
#

I don't understand what clang-format is aligning stuff to here

  Fwog::SwapchainRenderInfo swapchainRenderingInfo{
      .viewport =
          Fwog::Viewport{
              .drawRect{.offset = {0, 0}, .extent = {gWindowWidth, gWindowHeight}},
              .minDepth = 0.0f,
              .maxDepth = 1.0f,
          },
    ...//some other stuff
#

my indent size is 2

#

maybe it's aligning initializers with the end of the namespace 🤔

dire badge
#

clang format is still too limited

long robin
#

looks like it always aligns it to four spaces in this scenario 😦

  longlong::FooButWithARatherLongName myincrediblyLongNamedFoo{
      .bar = longlong::Bar{.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 0,
                           .bbbbbbbbbbbbbb = 1,
                           .cccccccccccccc = 2,
                           .dddddddddddddd = 3,
                           .eeeeeeeeeeeeee = 4,
                           .fffffffffffffff = "hello",
                           .baz = "world",
                           .gg = 1}};
daring surge
#

clang format does really bad with the named initialization sort of stuff

#

i tried for a while to get decent settings and couldnt

long robin
#

there also aren't enough penalty options

#

it likes to break in some really annoying spots

heavy cipher
#

my advice is to not bother

#

having it automated is more important than what it is

long robin
#

this is good and normal

#

ignore the red squigglies, my intellisense is having a syndrome rn

golden schooner
#

quite sad that clang format still cant do simple stuff, but ye, more important that it does something

long robin
#

I suppose so

golden schooner
#

i wonder why nobody reinvented some c++ formatting thing "made with rust" yet

long robin
#

lol

heavy cipher
#

btw pro git tip

#

you can exclude the commit that reformats the entire repo from blame

golden schooner
#

ye, rewriting history

long robin
#

I actually don't use git blame like ever 🫠

#

it's pretty easy when you don't write bugs

heavy cipher
golden schooner
#

ah, thought this might be something like that 🙂

long robin
#

the .git-blame-ignore-revs thing was pretty easy to add frogapprove

heavy cipher
#

remember to let devsh know this any time he posts any of his crunk-ass-unformatted nabla code

long robin
golden schooner
long robin
#

ugh I don't want to spam * and -> everywhere

long robin
#

where is the download button

#

ah it's stealthy

golden schooner
#

you need to be logged in :/

#

ah

long robin
#

I'm not used to this site

golden schooner
#

hmmmmmmmmmmmmmmmmm

long robin
#

it's just bright due to the lighting btw

golden schooner
#

ja

long robin
#

it seems to render properly

golden schooner
#

it does

#

looks like my stuff cant 🙂

#

merci

long robin
#

no hay de que

brisk narwhal
#

with

template <typename T, size_t A = alignof(T)>
struct MyAlignedStorage {
    alignas(A) std::byte storage[sizeof(T)];
};```
long robin
#

I wish there was a way to make it act "like" the object it's potentially storing without having to change the usage syntax everywhere

#

basically I just want a deferred init object

#

guess I'll just use an optional

brisk narwhal
#

you could have an implicit conversion operator

long robin
#

yeah but I couldn't do myThing.foo() still

golden schooner
#

can you change A to Alignment?

brisk narwhal
#

hmm

long robin
#

at least I could use it for function arguments

brisk narwhal
#

you could wrap the aligned storage to some kind of Convert<T>

#

so like, Convert<AlignedStorage<YourThing>>

long robin
#

maybe I could make it a union

brisk narwhal
long robin
#

I managed this so far

template<typename T, size_t A = alignof(T)>
struct AlignedStorage
{
  operator T()
  {
    return *reinterpret_cast<T*>(storage);
  }

  template<typename... Args>
  void emplace(Args... args)
  {
    std::construct_at(storage, std::forward<Args>(args)...);
  }

  ~AlignedStorage()
  {
    std::destroy_at<T>(storage);
  }

  alignas(A) std::byte storage[sizeof(T)];
};
brisk narwhal
#

ye but I think overloading operator -> is the best course of action right now

long robin
#

ye

brisk narwhal
#

unless you want to T(storage) everywhere

long robin
#

nah

#

operator-> it is

brisk narwhal
#

also remember to launder

long robin
#

I'm not 100% sure it is necessary

#

brb lemme look at lifetime rules for the 100000000th time

brisk narwhal
#

[basic.life] here we go

long robin
#

I guess std::launder can't hurt

#

basically just sprinkling a little voodoo into the mix

#

std::launder is the MSG of C++ programs

brisk narwhal
#

actually it's not necessary

#

not a const type

shell inlet
#

77mb 1k textures

#

I should try it

golden schooner
#

heh

brisk narwhal
#

cool model

#

fun fact, it took my ktx converter 2 minutes to convert all the textures

#

and it's AVX2 KEKW

long robin
#

4k textures though?

brisk narwhal
#

ye

long robin
#

thicc

shell inlet
#

had to scale down but works

long robin
#

the 1k version loads in like 250ms for me

#

also I had to scale it down to like 1/32

shell inlet
#

you don't mipmap

long robin
#

ye

brisk narwhal
#

I don't either

#

precomputed mipmaps for the win

shell inlet
#

but opengl generates them on GPU maybe? Idk

#

so wouldn't make a difference (probably)

long robin
#

actually the only reason I don't mipmap is because the 33% increase in memory usage makes new sponza not run on my PC KEKW

brisk narwhal
shell inlet
#

💀

long robin
#

unless it's a bad driver

shell inlet
#

by the way it took less than 2 minutes to load even with CPU mipmap generation in debug build

#

I also use ktx lib for compression, it also compressed them to bc7

#

the only difference may be is that I have it all multithreaded

brisk narwhal
#

if you use ktx why are you generating mipmaps at runtime? thonk

shell inlet
#

because of ktx

#

wait misread the question

golden schooner
shell inlet
#

honestly not sure but why not

golden schooner
#

yours too void

brisk narwhal
#

heh fair enough

golden schooner
#

took me a second to see the specular reflections 🙂

brisk narwhal
#

I prefer precomputing mipmaps since ktx allows you to

#

it makes loading a texture blazing fast

shell inlet
#

but would ktx do it on gpu though

#

if not it makes no difference for me

brisk narwhal
#

there is nothing to do at runtime, you simply copy over the bytes to the GPU

#

the mipmaps are already there

shell inlet
#

I don't do anything at runtime

#

it's once at import

#

then it's stored as ktx

brisk narwhal
#

ah fair enough

#

then I think your method is better than mine

#

but I can't be bothered generating mips on the GPU tbh

shell inlet
#

if you're compressing them you can't even do that

#

blitting to compressed formats is not supported anywhere

brisk narwhal
#

big sadness

long robin
#

Treat compressed textures as read-only

golden schooner
#

comperssed textures are also on my todo list

shell inlet
golden schooner
#

oi

#

that looks neat

shell inlet
#

sometimes I like playing with materials for no reason whatsoever

golden schooner
#

: )

brisk narwhal
golden schooner
#

it looks great in that style

shell inlet
#

and sorry jaker for flooding your thread with offtopic

long robin
#

Lol it's fine

#

This is relevant-enough discussion

golden schooner
#

its std::optional, albeit not aligned

long robin
#

I want to add dxt (s3tc) support, but I haven't found a nice library for loading them yet

#

stb only has a library for writing to them

#

hmm maybe that could be useful for converting

dire badge
long robin
#

yeah

long robin
#

kinda complex though

#

this is just a simple gltf viewer, not a full-blown engine 😄

viral haven
long robin
#

I'll try that in a bit when I'm back on

viral haven
#

I get this output (using the clang-format from Fwog). : cpp FooButWithARatherLongName myincrediblyLongNamedFoo{ .bar = longlong::Bar{ .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 0, .bbbbbbbbbbbbbb = 1, .cccccccccccccc = 2, .dddddddddddddd = 3, .eeeeeeeeeeeeee = 4, .fffffffffffffff = "hello", .baz = "world", .gg = 1, }, };

long robin
#

ah yeah I already have a trailing comma in the real example I have 😦

#

oh well, it's not too bad

#

and I'd rather have this than no auto formatting

long robin
#

@viral haven the trailing comma trick comes in handy in quite a few places though. I'm glad to know it

viral haven
#

Glad to know it's helpful for you frogeheart

golden schooner
#

luckily the compiler is forbiving there

#

affects other langauges too

golden schooner
#

@long robin

#

when would you use the _REV version of your formats in fwog?

#

like USHORT_5_6_5_REV,

#

or in opengl in general

long robin
#

some file formats just have the data specified weirdly like that

#

in one of my first graphics classes we encountered some BGR textures

golden schooner
#

thats not what i wanted to hear

#

but it means, they could be safely omitted in fwog

#

the _Rev ones at least

long robin
#

it's not hard to support them

#

it's like 2 lines for each lol

golden schooner
#

or otherwise obscure formats like R2G2B2?

#

sure

long robin
#

maybe I can go through and look at support for the optional ones

golden schooner
#

would reduce clutter here and there i suppose

#

you assert anyway

#

i saw that at UploadType just now btw

brisk narwhal
#

@long robin I suppose it is not viable nor useful to make multiple cascades of an RSM right?

long robin
#

it could be useful. I don't see why not

brisk narwhal
#

The indirect illumination should only be computed on what's inside the view frustum

#

Or am I missing something

#

Wait let me read the paper again

long robin
#

the work is already done on a per-pixel basis

#

the idea is that you sample the RSM many times for each pixel on the screen

#

the work is not done in light space (except for rendering the RSM itself, which is a relatively cheap scene pass)

brisk narwhal
#

Yeah ok

long robin
#

but yeah the paper is like 5 pages so I guess read that

#

hmm, I think I GL_DONT_CARE about this

golden schooner
#

i know d2d1 uses BGRA, thats why you have to create the swapchain with support for that, if you want to have 2d shizzle on top of your 3d nonsense

#

also TIL, i thought REV was some sort of Revision 🙂

#

ah

#

now it makes sense

#
    UBYTE_3_3_2,
    UBYTE_2_3_3,
#

should also be

#
    UBYTE_3_3_2,
    UBYTE_2_3_3_REV,
#

ye the other _REVs are not correctly named either 😉

long robin
#

Hmm I thought I copied OpenGL's sketchy-ass naming convention

#

Oh well, I'll check it again tomorrow after I sleep

golden schooner
#

just assign it to me

#

ill take care of it when im back

#

you got more important things to implement 😛

long robin
#

Ok ferrisOwO

golden schooner
#

cant assign it myself for some reason

long robin
#

I did it

brisk narwhal
#

Does this library have examples for dynamic sparse GPU octrees?

#

I can't seem to figure out how to implement a good construction algorithm for those

golden schooner
#

fwogs sources are weirdly spread out 🙂

long robin
brisk narwhal
long robin
#

What do you want them for?

#

I've never implemented a GPU octree before

brisk narwhal
#

voxels

#

billions and billions of voxels

long robin
#

I see

#

You could join the voxel dev server and ask

#

There are some papers people can point you towards

brisk narwhal
#

Oh

#

there's a voxel dev server

#

thanks

long robin
#

It's in #related-servers I think

brisk narwhal
#

this is so good

#

they even have example shadertoy implementations

golden schooner
# long robin Can you explain

im trying to implement your deferred rendering example in EngineKit and was kinda lost finding impls for the pipeline stuff

#

its like split across 4 units somehow

#

but its just a me thing anyway

long robin
#

What stuff exactly?

golden schooner
#

BindGraphicsPipeline

#

i now know wher it is, after rembering it hiding in detail/

long robin
#

Isn't that in Rendering.cpp

golden schooner
#

in Rendering.cpp tho

#

ye

#

in Rendering i would expect something like an implemented renderpass of sorts

#

not BindXXX

long robin
#

I see

golden schooner
#

like i said, its just me

long robin
#

I just threw all the Cmds in there

golden schooner
#

yep

#

there are also stil some deadbody logic op things in there hehe

#

thought we removed those, mmh i could be rong

long robin
#

I guess I left them because it was easier than removing them

golden schooner
#

also possible

long robin
#

refactoring examples takes forever

#

and so does extensive commenting

long robin
#

It also sucks when you have to initialize a complex object, like a pipeline, in an initializer list

#

Another use case for the DelayedInit class

golden schooner
#

a what?

#

use a builder

long robin
#

Doesn't solve every case

#

Plus, I can fix my particular problem by using optionals instead of pointers in certain places

golden schooner
#

what do you mean with every case?

#

with a builder you can also counter wrong input or states which make no sense, when you are able to edit the descriptor willy nilly, you have to validate it somewhere else, and that pollutes the other place with code which shouldnt be there - BindXXXPipeline for instance

long robin
golden schooner
#

lambda could work too, although it will uglify the code where you build it, more indentation more {} and =>s

#

hmm can you actually assign normal methods as well and pass them instead of lambdaise the code?

#

something like

Foo(param => Console.WriteLine(param));

vs

Foo(DoSomeShit); 
// or
Foo(param => DoSomeShit(param));

void DoSomeShit(string param)
{
  Console.WriteLine(param);
}
long robin
golden schooner
#

ok

long robin
#

I guess I can just show you what I come up with when I'm done with the refactoring, then you can tell me if it's poop

golden schooner
#

😄

#

thats how we do it here

brisk narwhal
#

Imagine having to use the ->* operator

#
struct X {
    void x(...) {}
};

void f(X* x, void (X::*f)(...)) {
    (x->*f)(...);
}```function pointers to member functions were a mistake
#

that's why we had std::bind

#

and now we have lambdas™️

dire badge
#

erhe mostly avoids pimpl

long robin
#

clang-format is once again triggering me

#

it seems to be ignoring BreakConstructorInitializers

#

it only respects BreakConstructorInitializers: 'BeforeComma' which looks like ass

#

better than the abomination shown in the first pic I guess

heavy cipher
#

the infamous comma

#

try BreakConstructorInitializers: 'OxfordComma'

long robin
#

that oxford comma actually didn't influence anything

#

oh mama I fixed it

#

ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'

#

also my other problem with everything being indented by 4 even though I specified an indent width of 2 is fixed

#

turns out there are like five options for influencing indent width, and they all affect different things

#

my skin is feeling smooth

heavy cipher
#

the potion of lignification is wearing off

long robin
#

the ligmafication potion is now kicking in

#

and I think the potion of marttyfication is making me experience psychosis

heavy cipher
#

in a good way?

brisk narwhal
#

as a (soon™️ to be) medical doctor I can assure early onset psychosis does feel good for the patient

long robin
#

this current mood

#

how I want to feel:

long robin
#

mfw swapping delayed init objects is really cursed

#

guess I do need a bool to indicate whether the object has been initialized after all

heavy cipher
#

wots delayed init object

long robin
#

aligned storage + helper functions

heavy cipher
#

why is it cursed?

long robin
#

I'm pretty sure you can't just swap the object representation of two objects

#

plus I do this totally-not-sketchy thing where I call the managed object's destructor no matter what

heavy cipher
#

oh no

#

now i wanna see this

long robin
#
template<typename T>
struct DelayedInit
{
  template<typename... Args>
  void emplace(Args... args)
  {
    std::construct_at(&value(), std::forward<Args>(args)...);
  }

  operator T&()
  {
    return value();
  }

  T* operator->()
  {
    return &value();
  }

  T& value()
  {
    return *reinterpret_cast<T*>(storage);
  }

  void destroy()
  {
    std::destroy_at<T>(&value());
  }

  ~DelayedInit()
  {
    destroy();
  }

  alignas(T) std::byte storage[sizeof(T)]{};
};
#

it has... several problems

#

turns out what I actually want is std::optional

heavy cipher
#

sensible

long robin
#

I discovered the cursed problems when I tried to std::swap two DelayedInit objects

heavy cipher
#

i am still not sure what the issue is with swap

#

but using optional is def easier

long robin
#

std::swap is implemented with three moves and a temporary

#

when the temporary dies, it's murdering one of the objects I care about with my DelayedInit

heavy cipher
#

well yeah, you need to add move support

#

thats already an issue if you want to have this as a member

#

object my beloved

long robin
#

but yeah just using an optional would be easier

heavy cipher
#

ah yeah

long robin
#

plus I don't have to worry about manually destroying the thing if I want to emplace into it again

golden schooner
#

is DelayedInit<T> something like a Lazy<T>? which gets its value when you read from it the first time

#

name is really confusing

long robin
#

it's gone, don't worry about it

#

it's a mere memory now

golden schooner
#

i was seriously curious

long robin
#

the code for it is above

#

I don't know what Lazy<T> is, but your description sounds like not the same thing

golden schooner
#

ok

long robin
#

DelayedInit is supposed to allow you to call the constructor later

#

also I just noticed that the framebuffer cache in Fwog is broken when you delete textures

#

cuz the cached framebuffers using that texture don't get removed as well

golden schooner
#

good find

long robin
#

discovered after I noticed that window resizing wasn't working for some reason

golden schooner
#

ah and it sounds exactly like lazy 🙂

#

im currently also busy trytig to replicate deferred.cpp into EngineKit

long robin
#

the difference is that DelayedInit does no lifetime tracking on its own (it only holds aligned storage), so it's easy to create bugs with it

golden schooner
#

manually creating shapes is a pain in the butt 🙂

long robin
#

I'm refactoring deferred.cpp right now

golden schooner
#

fook

#

i also noticed 2 other things

long robin
golden schooner
#

ah so i should look at gltf viewer instead

long robin
#

yeah

golden schooner
#

alright

long robin
#

the features of these examples are kinda all over the place

golden schooner
#

thats totally fine

#

the other 1 thing i noticed

long robin
#

oh I need to reorganize those too

golden schooner
#

that people use input attributes in all sorts of orders

#

thats no critique at all, just an observation 🙂

#

since i kindof used the same order in my engines for ages

#

Position = 0, Normal = 1, Color = 2, Uv = 3, Tangents = 4

#

i suppose my vertextype enum makes no real sense then, since it dictates a specific order, and all involved shaders must follow

#

probalby better to provide an inputlayout vertexbinding builder of sorts, with a simple interface

#

or optional let reflection do the majeek

long robin
#

vertex attributes are kinda yolo for me

#

it doesn't really cause me problems (yet)

golden schooner
#

ye its really just a few lines anyway, for declaring them somewhere

#

hmm

#

now im finking

#

when building the pipeline

#

it could technically also take care of building the vertexbinding automagically

#

and you dont even have to worry about, when you link the shaders, you can reflect the input attributes, and with that build the vertexbinding

long robin
#

how so?

golden schooner
#

only probwem is, when your shaders suck, and the attributes are not used

long robin
#

what about normalized attributes like colors?

#

how would you infer that it's normalized from the shader?

golden schooner
#

i was just thinking about that

#

thats impossible

long robin
#

maybe you could introduce HLSL semantics 🤰

golden schooner
#

hehe

#

nah

long robin
#

I hate those fyi

golden schooner
#

you would have to force people to use those

#

explicit vertexbindings you have to provide, it is

dire badge
#

Every couple of years I try clang format and it disappoints me every time

brisk narwhal
#

do you mind if I try to implement SDFDDGI with Fwog

#

as a quick prototype

long robin
#

I don't mind

#

Just let me know if you see something wack

brisk narwhal
#

my stuff is in a broken state due to me trying to automate synchronization with render graphs

#

and I've decided to take a break nervous

long robin
#

Fwog has a built-in render graph called OpenGL

dire badge
#

"graph" 🤣

long robin
#

the "graph" is silent

golden schooner
#

there should be a series hosted on this server

#

"Fwog in Action"

#

where people add stuff or make stuff with it

long robin
#

You mean fwog-bug-showcase

#

Fwog doesn't even have a version number yet

golden schooner
#

: )

#

thats a minor problem

heavy cipher
#

without a version number, how would we know? could be a major problem

long robin
#

I should patch that

golden schooner
#

looks like gltf_viewer and co are fucked atm

#

or somebody added a bunch of stuff which my igpu doesnt support anymore

#

or both

golden schooner
#

i cannot run anything from fwog anymore

#

getting this stuff instead

#
OpenGL Debug message (1): 0:137(54): error: parameter `in offset' must be a constant expression
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (2): 0:137(16): error: type mismatch
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (3): 0:138(68): error: parameter `in offset' must be a constant expression
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (4): 0:138(31): error: type mismatch
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (5): 0:138(16): error: no matching function for call to `LinearizeDepth(error)'; candidates are:
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (6): 0:138(16): error:    float LinearizeDepth(float)
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (7): 0:139(10): warning: `normal' used uninitialized
Source: Shader Compiler
Type: Other
Severity: high
OpenGL Debug message (8): 0:139(44): warning: `depth' used uninitialized
Source: Shader Compiler
Type: Other
Severity: high
OpenGL Debug message (9): 0:141(43): error: parameter `in offset' must be a constant expression
Source: Shader Compiler
Type: Error
Severity: high
OpenGL Debug message (10): 0:141(11): error: type mismatch
Source: Shader Compiler
Type: Error
Severity: high
Error: Failed to compile shader source.
#
0:137(54): error: parameter `in offset' must be a constant expression
0:137(16): error: type mismatch
0:138(68): error: parameter `in offset' must be a constant expression
0:138(31): error: type mismatch
0:138(16): error: no matching function for call to `LinearizeDepth(error)'; candidates are:
0:138(16): error:    float LinearizeDepth(float)
0:139(10): warning: `normal' used uninitialized
0:139(44): warning: `depth' used uninitialized
0:141(43): error: parameter `in offset' must be a constant expression
terminate called after throwing an instance of 'Fwog::ShaderCompilationException'
  what():  Failed to compile shader source.
0:137(54): error: parameter `in offset' must be a constant expression
0:137(16): error: type mismatch
0:138(68): error: parameter `in offset' must be a constant expression
0:138(31): error: type mismatch
0:138(16): error: no matching function for call to `LinearizeDepth(error)'; candidates are:
0:138(16): error:    float LinearizeDepth(float)
0:139(10): warning: `normal' used uninitialized
0:139(44): warning: `depth' used uninitialized
0:141(43): error: parameter `in offset' must be a constant expression
0
zsh: IOT instruction (core dumped)  /home/deccer/Private/Code/External/Fwog/build/example/deferred
long robin
#

Looks like an error in the RSM shader that anonten changed

#

Isn't texelFetch(...).x a float

golden schooner
#

i thought so too

long robin
#

Oh

golden schooner
#

misplaced braces?

long robin
#

It's complaining about the parameter to texelFetchOffset first

golden schooner
#

ah

long robin
#

The offset parameter

#

It's a constant expression but not really

#

I gotta refactor that shader anyways

#
#define PI     3.141592653589793238462643
#define TWO_PI (2.0 * 3.14159265)
daring surge
#

if only there were a name for two pi to shorten some characters

#

perhaps like TWOI or something

heavy cipher
#

HALF_TAU
TAU
pls

daring surge
#

maybe TAI? TAU?

#

also no 2.0 * PI hurts me

heavy cipher
#

or the lesser known (double)PI

daring surge
#

what i usually do is

float pi = 3.14;
double pi = 6.28;```
long robin
#

(half)TAU

golden schooner
#

i used to play in a guild called Nok'Tau Order Malion, does that count too?

daring surge
#

holy shit math reference in the game name

#

legendary

golden schooner
#

the texelfetchoffset needs to be rewritten to

vec3 normal = texelFetch(s_gNormal, coord + offset, 0).xyz;
#

neh?

#

yep

#
vec3 Tap(in sampler2D tex, ivec2 coord, ivec2 offset, vec3 src_normal, float src_depth, inout float sum_weight)
{
  vec3 result = vec3(0);
  vec3 normal = texelFetch(s_gNormal, coord + offset, 0).xyz;
  float depth = LinearizeDepth(texelFetch(s_gDepth, coord + offset, 0).x);
  if (dot(normal, src_normal) >= 0.9 && abs(depth - src_depth) < 0.1)
  {
    result = texelFetch(tex, coord + offset, 0).xyz;
    sum_weight += 1.0;
  }
  return result;
}

that compiles

long robin
#

discord's syntax highlighter thinks offset is a keyword

golden schooner
#

: )

#

maybe it is

#

just noticed gltf_viewer example runs in single digit fps :>

#

deferred as well

brisk narwhal
#

deferred is bound to run worse

long robin
#

RSM is probably taking a toll on your iGPU

#

what if you try pressing 0 to enable the filtered version?

golden schooner
#

theres no difference

long robin
#

you could try changing the source to reduce the number of samples or filter passes

golden schooner
#

i lied

#

when i run it it somewhat chuggs along, when i then press 0 it runs half speed of what was before

long robin
#

oof

shell inlet
#

because it's full resolution KEKW

golden schooner
#

: )

#

having no indicator in titlebar or imgui sucks a little

#

of what is active right now

shell inlet
#

btw what happens if you increase the radius on the original impl

golden schooner
#

RSMFilteredSamples = 2, and Filtered = true runs like ass

shell inlet
#

it's 2 key

#

0 sets filtered to true at runtime

golden schooner
#

i can see changes

#

also while pressing f4 its more obvious

#

but performance is still not good at all

shell inlet
#

f4?

#

alt f4?

golden schooner
#

: )

#

F4

#

show indirect lighting

shell inlet
#

I didn't know that was a thing

golden schooner
#

F3 shows depth, F2 Normals

#

F1 base color

long robin
#

alt+f4 shows the window behind this one

shell inlet
#

what was the error in my code by the way

golden schooner
#

texelFetchOffset

#

the offset param needs to be constant

long robin
#

the way it is right now is weird

shell inlet
#

what why

long robin
#

if you inline all the code it is a constant expression

#

but you also pass it via a parameter that isn't const

golden schooner
#

i switchedoffset it to texelFetch and value+offset

shell inlet
#

also I don't think that igpu is suited to run any gi other than baked one

#

so if it runs like shit I am not surprised

golden schooner
#

very true

#

the previous implementation was running "faster" tho

#

(im not complaining)

shell inlet
#

it was exactly half res

golden schooner
#

: )

shell inlet
#

and all coherent samples even if 400

long robin
#

caches op

shell inlet
#

so it's harder to compare unless this is also made half res

#

when I started I was like wtf is this code and just made it full resolution

#

because wanted to cut to the chase

#

honestly I think that convergence on this thing is atrocious

#

if it wasn't as bad we could put a narrower filter on it

#

but alas we are sampling a big surface with a disk in 2d so idk how to guide samples better

#

I guess we could make it even more nonlinear to sample closer

brisk narwhal
#

may I introduce you to voxels

shell inlet
#

no

brisk narwhal
#

VXGI is the real deal™️

shell inlet
#

real meal

long robin
#

how do I voxelize the scene

shell inlet
#

VRAM is the real meal for VXGI

brisk narwhal
#

4GB 3D texture KEKW

long robin
#

huh

brisk narwhal
#

actually I just realized I can't do more than 1024x1024x1024 because my 3070 only has 8GB of VRAM

#

I clearly need a 3090

long robin
#

can't you do cascades

shell inlet
#

clipmaps

brisk narwhal
#

true

long robin
#

clippy mappy

brisk narwhal
#

need to learn more about this stuff

#

GPU gems only has a chapter about painting meshes with octrees

#

I need more knowledge

long robin
#

father

#

I crave knowledge

golden schooner
shell inlet
#

rtx 5k?

#

is it a thing

golden schooner
#

no

#

fat fingers

long robin
#

AMD GPUs have more VRAM on average

shell inlet
golden schooner
#

erm

shell inlet
#

bro waht this is ril

golden schooner
#

the A6000

brisk narwhal
#

"hi yes I need a quadro RTX 6000"
"why do you need it"
"intel sponza will not voxelize itself"

golden schooner
#

thats what i meant

#

eh lol

shell inlet
#

rtx 8000 that is not air-conditioner sized???

shell inlet
#

into a d3 tex

long robin
#

hmm with an ortho projection?

shell inlet
#

naturally

long robin
#

don't you need conservative raster

shell inlet
#

unless you want to add a certain hint of perspective to your voxelized scene but that's kinky imo

long robin
#

I'm wondering how you'd voxelize walls if you were rendering XZ slices (top-down or bottom-up)

#

you'd have to thicken the walls somehow

shell inlet
#

conservative raster too ye

#

there was an article from novidia somewhere

#

about voxelization

long robin
#

but not all hw supports it 😦

#

inb4 geometry shaders

shell inlet
#

it was around time when nvidya was flexing vxgi

brisk narwhal
#

it's fine

#

16% is high enough

shell inlet
#

there it is

long robin
#

shall read it

brisk narwhal
#

I shall too

long robin
#

but first I gotta eat

shell inlet
#

I think you don't have to render slice by slice, I think you can disable early depth test and do image store from the fragment shader, if that's possible idk

#

or maybe only disabling depth test will do, because without it I think the rasterizer shouldn't try to discard anything and use painter's algo

long robin
#

you could probably do it efficiently with a compute shader

long robin
shell inlet
long robin
#

ye 😄

brisk narwhal
#

writing software rasterizers in hardware rasterizers

#

good shit

#

nanite does something similar too

long robin
#

I realize that since you can do image store in fragment shaders, you probably don't need a compute shader after all

shell inlet
#

that's the thing, CS raster outperforms hw only on small tris

long robin
#

except maybe you can do more efficient sw conservative raster in a compute shader

brisk narwhal
#

is async compute a thing on opengl

long robin
#

no

brisk narwhal
#

rip

long robin
#

it's an overhyped feature anyways

brisk narwhal
#

well you need heavy compute workloads to justify using it indeed

#

otherwise sync overhead kills the benefits of async comput

long robin
#

not only that, but you need workloads that don't consume the same resources which can run in parallel

dire badge
#

What does RSM stand for? reflection shadow map?

long robin
#

reflective shadow maps

dire badge
#

thx

dire badge
#

Yesh I have seen that I think

shell inlet
#

funny how all yt videos I've seen have not implemented it properly

#

I think authors omitted the maths needed for that

#

the monte carlo part

long robin
#

what, RSM?

shell inlet
#

y

long robin
#

I don't think the authors themselves used the maths needed for it

shell inlet
#

that would be a plot twist

long robin
#

what issues do you see in the videos?

shell inlet
#

ad hoc intensities

long robin
#

i c

#

sounds familiar KEKW

shell inlet
#

that one problem I cracked so that fwog may be one of the physically correct-ish ones

long robin
#

this was also before the age of PBR, so maybe that's related

shell inlet
#

btw I think you need to fix your impl as well because why not

long robin
#

actually I don't know what's broken

shell inlet
#

the pdf

#

aka 1/pdf the weight

#

compare the code of illumination computation it should be obvious what to change

#

I think I should commit latest changes to my fork btw

shell inlet
#

there is broken ass commented out occlusion test

#

and cleaner code, jsut a bit

#

wait a sec

#

I will commit something

long robin
#

jokay

shell inlet
#

huh wait maybe I already did

golden schooner
#

fix the texelFetchOffset too while at it 🙂

long robin
#

I can fix that

shell inlet
#

no the fork is pretty much dead

#

I won't PR amynore

long robin
#

ye I waited quite a while to merge it

#

to make sure you were done

golden schooner
#

oh

#

i was just doing main earlier, thought it was all mergered already

long robin
#

it is

golden schooner
#

i R confuse

long robin
#

the fork has been merged

#

it's in main, the one you're looking at

long robin
#

that is different

shell inlet
#

this is a bit optimized because I took the constant area term out of the weight and multiply the sum by it instead

#

and removed unused uniform sampling because it's useless

#

this is the commit

long robin
#

you made the noise bigger

shell inlet
#

ignore any noise

#

I was experimenting a lot

#

only important thing is the shader p much

#

as a matter of fact you should put imgui in there and add sliders and stuff to tweak the thing

long robin
#

yeah that has been painful

#

my refactor adds imgui to every example

#

and automated camera controls and stuff

shell inlet
#

by the way interpolation pass may also help

#

so that filtered version also works in half resolution

long robin
#

💀

      const int numGroupsX = rsmUniforms.targetDim.x;
      const int numGroupsY = rsmUniforms.targetDim.y;
#

how did this get here

#

I was wondering why occupancy was like 14% and the average instructions/thread was 0.5

#

lmfao now perf is several times better

#
      const int localSize = 8;
      const int numGroupsX = (rsmUniforms.targetDim.x + localSize - 1) / localSize;
      const int numGroupsY = (rsmUniforms.targetDim.y + localSize - 1) / localSize;
#

somehow the incorrect calculation was being done only for the filtered version of RSM

#

now these SOLs are much closer to what I was expecting for the filtering passes

#

I guess the scheduler was being murdered before

brisk narwhal
#

amd employee caught using competition's software

long robin
#

I use nsight all the time at work to look for competitive deficits in games

#

no cap

#
  1. profile game with nsight on nv gpu
  2. profile game with RGP on amd gpu
  3. compare how long each pass takes
  4. ???
  5. profit
golden schooner
#

noice

#

it does run faster indeed

#

i was also able to resurect some amd card

#

R9

long robin
#

it literally runs like 5x faster

#

after just fixing the workgroup count

golden schooner
#

with the old numgroups even there it ran like shit

#

some frametime display would be nice 🙂

long robin
#

if you don't enable the filtered mode, it has the correct WG count

#

yeah it's in the imgui stuff I'm adding in the refactor

golden schooner
#

ye one mode ran like shit, the other didnt

long robin
#

controls + FPS display

golden schooner
#

now both are smoof

long robin
#

I didn't push anything though

#

😳

golden schooner
#

i manhandled the code myself

long robin
#

epic

golden schooner
#

some people call me that

long robin
#

it's true

golden schooner
#

glad i got fancontrol to work too, otherwise i would have gone deaf

#

sounds like an industrial hoover 😄

long robin
#

lol

golden schooner
#

absolutely have no clue whats kaputt with this thing, took 4 hrs or so to get a working combination

long robin
#

it's kinda crazy how high tech electronics are manufactured in a way that makes certain issues almost impossible to diagnose or fix

golden schooner
#

ye

#

it was much worse 15 years ago

#

im suspecting the cpu is kaputt somehow, something about the C states

long robin
#

like, if you drill a single hole randomly in a GPU board (avoiding all capacitors and stuff) it is probably unsalvageable even though you just broke some copper traces

golden schooner
#

some important copper traces ;P

long robin
#

if you actually hit the die then it's unsalvageable^2

golden schooner
#

heh

long robin
#

these things are manufactured with actual magic

golden schooner
#

its just photographs

long robin
#

photolithographs 😳

golden schooner
#

layered on some sort of metal amalgam

#

its mind boggling

long robin
#

ye

#

would be interesting to study just to figure out how humanity even got to this point

golden schooner
#

like nvidias a100? with 56 BILLION transistors

#

there is some sort of documentary about the first transistor

#

and how people were assholes back then as well

long robin
#

do you remember the name of it?

#

try not to burn your eyes looking at that site

golden schooner
#

there was something on youtube iirc

#

its been a while, re the documentary

#

the other thing i dont think i have heard b efore

long robin
#

it's weird because it seems like the inevitable future, but no one talks about it

#

this seems to be the only "for normal people" video with some popularity talking about it. Basically all the others are lectures with ~10k views
https://youtu.be/jv2H9fp9dT8

golden schooner
#

ah i know this one

long robin
#

that guy is pretty entertaining

golden schooner
#

indeed

#
  • the sco'ish accent
#

i used to work with a super cool dude from scottland several years ago

#

an old fart, but best architect ive ever met lol

long robin
#

all the fried food made him smarter probably

golden schooner
#

informeeeeeeeeeeeeeeeeeaaaaaaashn

#

can you also ImGui::Image all the debug textures? 🙂

long robin
#

I prefer having the buttons to toggle the fullscreen view of the textures

#

because of the 1-1 pixel mapping

#

however, I can make a concession for u

#

but I gotta go to bed so I'll do it tomorrow

golden schooner
#

fair

#

and fair

#

and ill allow it

#

good shleep

long robin
#

ok I haven't slept yet because I was debugging

#

imgui samples the nonexistent alpha channel of my texture, so it's completely blank

#

ah, I need to change the bg color

#

maybe

#

yeah no it's all black now

#

I need to change the sample state of my texture with raw GL calls which is yucky

#

kill me

    glTextureParameteri(frame.gcolorTex.value().Handle(), GL_TEXTURE_SWIZZLE_A, GL_ONE);
    ImGui::ImageButton(reinterpret_cast<ImTextureID>(static_cast<uintptr_t>(frame.gcolorTex.value().Handle())),
                       {100, 100},
                       {0, 1},
                       {1, 0});
#

ok real sleep time

golden schooner
shell inlet
#

I guess I forgot to write the rest of the expressions before moving on

shell inlet
#

I guess RTX cards can tank about any bs there is

long robin
#

I'm gonna try an atrous filter and see if it performs or looks any different

#

also gonna try a tiny bayer matrix for noise

#

then I will see if I can get away with doing everything at quarter res

shell inlet
#

on filtered version already filtered by atrous?

long robin
#

no, just replacing the existing one

#

but I meant a different version of it I guess

shell inlet
#

I would be more concerned about the variance in unfiltered image

#

it's too bad for any filter

#

should add a checkbox for the filtered version to skip filter passes

#

did you fix your version?

#

last I checked there were no commits on that

long robin
#

I included the stuff in your patch if that's what you mean

#

I haven't pushed anything for a while

#

I do have what I believe to be your latest changes though

shell inlet
#

no I mean fix unfiltered version's disintegration with radius increase

long robin
#

Oh I haven't fixed that, but it shouldn't be too hard

shell inlet
#

yes it's all in the weigt

golden schooner
#

jakerino, am i seeing it right that you like 2 spaces indentation?

#

feels like it was 4 before as it should be 🙂

long robin
#

it has been 2 spaces this whole time

#

the formatting got a little whacky when anonten added stuff, but I have since run clang-format

shell inlet
#

feels weird being referred to as anonten in this server

long robin
#

well your "actual" name is quite cursed to write

golden schooner
#

hmm i could have sworn it was 4 before, but ok

#

i noticed another error which keeps the project from compiling on clang14, a missing ;

shell inlet
#

people just say void

long robin
#

true

golden schooner
#

ill fix it with the incoming PR

long robin
#

okay

golden schooner
#

in about 30s 🙂

shell inlet
#

thirties?

long robin
#

secondz

shell inlet
#

gotta wait 10 years

golden schooner
#

hehe

shell inlet
#

can you notify me when you merge the imgui and fixes you've made so far?

#

push not merge

#

I guess commit

long robin
#

ye

#

will do

shell inlet
#

I wanna play with settings live because I was recompiling the thing before

long robin
#

yeah that workflow is sad

shell inlet
#

pretty weird thing to want to play with but I wouldn't be programming graphics if my preference in toys was mainstream

golden schooner
#

hehe funny commit id

long robin
#

cd bad, blu ray good

golden schooner
#

the 2 spaces trips me, just saying. rather unusual to look at

long robin
#

can't you make your editor display indentation at any width

golden schooner
#

thats like people using tabs over spaces and i have a different tab setting

long robin
#

also you're like the second person in this channel to say that my preference is weird 😂

golden schooner
#

im not complaining, just whining because it feels like you stand in front of thicc aquarium glass

#

4 spaces, best spaces 😛

shell inlet
#

I was first

long robin
#

the main advantage it has, imo, is preserving horizontal space

golden schooner
#

i use a 16:9 aspect ratio

#

not 9:16

long robin
#

lmao

#

but yeah I'm fine with 4-width indentation

shell inlet
#

but do you have two documents open in split view

golden schooner
#

thank you 🙂

long robin
#

not saying I'm going to change it btw

golden schooner
#

was about to ask anton if he would join me coercing you into 4 spaces

long robin
#

I'm just saying that 2 spaces is the convention for this project

shell inlet
#

aanton 👁️

golden schooner
#

or, you give me contributor rights

long robin
#

I have an idea

#

how about you adapt

golden schooner
#

: )

long robin
#

mr aquarium man

long robin
#

I used 2 spaces in every project I linked and you haven't complained until now 😩

shell inlet
#

to be honest I don't care because my code can't even decide between tabs and spaces

golden schooner
#

ye for some reason i didnt notice until yestertwodays ago when i was looking at the glsl

shell inlet
#

I adapted so much I don't care even if there is no spaces

#

or different spaces every line

long robin
#

heh

shell inlet
#

which is why I ruined jakers code

golden schooner
#

in my c# world this shit is formatted automagically for me whenever i save or close a scope

#

plus the default is 4 spaces indentation

#

anyway, as i said, i wasnt comaplainingngin

shell inlet
#

anyways why does the macro need a semicolon

#

in the commit

golden schooner
#

in clang it does for some reason

shell inlet
#

in the PR

long robin
#

that's weird

shell inlet
#

I guess it parses it just like any function call

#

even though it's a part of what preprocessor should turn into other code

long robin
golden schooner
#

hang on a second, it could alo be clangd

#

ok it still compiles liblibimgui just fine, with gcc

long robin
#

liblib

golden schooner
#

: )

long robin
#

that annoys me too, don't worry 😄

golden schooner
#

hmm didnt we merge tbb as well?

#

that change in some CMakeLists

long robin
#

yeah, you added it

#

wait no that was galunga

#

unless thonk

#

maybe the sceneloader needs it

golden schooner
#

ah, possible that it was galuga

#

it needs to be linked with all examples

#

hmm no

#

shit

#

gcc10 doesnt like the semicolon

#

gcc11/12 doesnt complain here

long robin
#

you shouldn't need the semicolon at all

#

intellisense might give a fake warning is all

golden schooner
#

ye, clangd

long robin
#

does it prevent you from compiling?

golden schooner
#

but these things should work the same

#

no, just tried it

#

clangd is the lsp here, that fucked with it

long robin
#

wtf

golden schooner
#

exactly

long robin
#

expanding the macro should just work

golden schooner
#
[build] [23/26  76% :: 4.917] Linking CXX executable example/deferred
[build] [23/26  80% :: 11.149] Building CXX object example/CMakeFiles/gltf_viewer.dir/common/SceneLoader.cpp.o
[build] [24/26  84% :: 11.531] Building CXX object example/CMakeFiles/gpu_driven.dir/common/SceneLoader.cpp.o
[build] [25/26  88% :: 11.598] Linking CXX executable example/gltf_viewer
[build] [25/26  92% :: 11.736] Building CXX object example/CMakeFiles/volumetric.dir/common/SceneLoader.cpp.o
[build] [26/26  96% :: 11.913] Linking CXX executable example/gpu_driven
[build] [26/26 100% :: 12.100] Linking CXX executable example/volumetric
[build] Build finished with exit code 0
#

it builds

#

super odd

#

now it doesnt complain about it anymore

long robin
#

phantom error

golden schooner
#

phantom muchentuchen?

#

anyway, ill remove that commit somehow

long robin
#

you have 24 hours

golden schooner
#

power of git rebase -i already solved

#

thats why you commit small changes 😉

long robin
#

I would've just made a new commit that undoes that one KEKW

golden schooner
#

nah

#

since i knew it was in the past 3 commits, i just did git rebase -i HEAD~3 (i for interactive)

#

then an editor pops up, and has 3 rows, one per commit, and i changed pick into drop in front of the offending commit

#

saved the file and git push --force done

#

alright PR builds successfully

long robin
#

4x4 bayer vs shitty 2x2 bayer vs 16x16 blue noise

#

@shell inlet how come the weight is just r in the new one instead of r * r? does it have to do with this: xi = mod(xi + noise.xy, vec2(1.0));?

shell inlet
#

where did you get r^2

long robin
#

previously (and maybe currently) the samples were biased toward the center of the disk

#

r^2 is 1/pdf of that or whatever

shell inlet
#

source?

#

proof?

long robin
#

idk but I'm sure it's true

#

bigger dots = more weight

shell inlet
#

what does visualization have to do with it

long robin
#

the likelihood of sampling a particular point

#

it's "importance" sampling

#

it's also in the original paper

shell inlet
#

I know that the distribution is not uniform, that's why the pdf is 1/r and not constant 1/pi

#

I don't know what is your point

long robin
#

I must've misunderstood

shell inlet
long robin
#

I think I got the wrong idea about the r^2 thing from the transformation you do to make it uniformly sampled

#

I will trust your math (never studied jacobian matrices)

shell inlet
#

not 1/r

#

because the pdf integrates to 1 and 1/r does not

#

1/pi integrates to 1 however which I can definitely say is a correct uniform sampling pdf for a unit circle

#

now what I'm not sure about is how to properly integrate over a circle

#

I guess since we have sin(theta) in hemispherical integral when validating pdfs and say nonuniform pdf would be cos(theta)/pi for cosine weighted, we integrate it and it yields 1, now for circle it would be r instead of sin(theta)

#

then integrating 1 like this gives the area of the circle as expected

#

1/r actually makes it integrate to 2pi meaning we need to normalize the pdf

#

so I guess proper pdf for a unit circle with quadratic falloff would be 1/2pir

#

jaker are you following

long robin
#

I'm reading

#

it seems quite bright when I use 2pir (this is just the indirect illumination texture)

shell inlet
#

like this?

float QuadraticCircleMappingWeight(float r)
{
    return TWO_PI*r;
}
long robin
#

yeah

shell inlet
#

what does the full image look like?

long robin
#

sun brightness = (2, 2, 2)

#

no tonemapping or anything as you know

shell inlet
#

the radius is so small though

#

still, I think it is overbright

long robin
#

it's still pretty darn bright when I increase the radius

shell inlet
#

looking at the red thing reflecting more light than it gets is the evidence

shell inlet
#

because 2pi is a constant multiplier on the integral

long robin
#

oh wait, you're looking at the top pic

shell inlet
#

adding or not this is weird

long robin
#

ye

#

it is too bright

shell inlet
#

if you shine a light with intensity 1 it should not become brighter than that

long robin
#

unless you concentrate it (which isn't happening here)

#

I think the picture could be lying to us though

#

the top pic is not direct illumination

shell inlet
#

can you make sun brightness

#

1

#

darn it I should probably load fwog again and do tests

long robin
#

indirect and direct (sun brightness = 1)

#

the indirect is measurably brighter

#

(.9, .18, .18) vs (.44, .086, .086)

#

almost exactly twice as bright up close

shell inlet
#

I think I get it

#

1/r together with the sampling radius will integrate to 2pir^2 and our r is rMaxWorld