#Platinum — Path Tracing in Metal

1 messages · Page 3 of 1

winged veldt
copper halo
#

so it works with links

#

but not files

#

ofc

winged veldt
#

i get the preview when writing the message too

#

but then it doesn't embed

copper halo
#

lmao

winged veldt
#

common discord L

copper halo
#

oh the link embed isn't correct hdr either

#

it converts to webp lul

winged veldt
#

man fuck webp fr

#

anyway ima just use libavif fuck discord

copper halo
#

oh avif doesn't support metadata either

#

fack

#

but they do support gain maps

winged veldt
#

🤔

#

does that mean you can't control how hdr gets displayed?

copper halo
#

yea

winged veldt
#

right

copper halo
#

you can't say what it was tonemapped for

#

so the browser/OS/monitor each get to choose what they do

#

one after the other

#

unless one of them disables the tonemapping in the later stages

#

argh i stacked my monitors and my old monitor looks so oversaturated bleaker_kekw

#

i love 'wide' gamut monitors that just stretch the input

#

and the srgb clamp mode just tints everything red agonyfrog

winged veldt
#

right i'm just reading a bit about formats and i think i might as well give up on getting hdr images to look good on anything other than the exact display they were authored on/for

copper halo
#

or you can export a video with a single frame

winged veldt
#

i mean isn't that kinda what avif is

copper halo
#

idk if av1 supports hdr metadata then lol

#

hey you can use ultra hdr

#

jpeg tho KEKW

#

it's pretty nice tho

#

it's sdr + gain map

#

so it looks good on sdr, and on hdr

winged veldt
#

does jpeg even support primaries other than 709?

copper halo
#

dunno

winged veldt
#

ah, it can embed icc profiles so yes

dense jacinth
#

what about .raw

winged veldt
#

is that an actual format? or you mean like, just output pixel data

dense jacinth
#

i was kinda joking but yes

winged veldt
#

i mean i can just output exr lol

#

but i still need colorspace data

winged veldt
#

i assume it's storing the gain map in one of the APPn markers

winged veldt
#

seems to be supported by openimageio as well

#

so now i just need to figure out icc color profiles and jpeg should do what i need

#

it's so jank though, i hate it agonyfrog

#

can we please retire fucking jpeg already

winged veldt
#

fucking libraries

#

fine, i'll do it myself

copper halo
#

lol

copper halo
#

if i render in rec2020 and don't tonemap at all i get this thonk

#

(idk what the screenshot is doing to color)

winged veldt
#

looks about right for an underexposed render, are you clipping to srgb?

#

(if you aren't, your display probably is)

timid frigate
copper halo
#

I'm outputting to a rec2020 pq swapchain

hazy zenith
#

So the input colors and textures are in sRGB and you convert them to rec 2020 and render in that colorspace?

copper halo
#

yeah

#

and that's the same as rendering in sRGB and then converting to rec2020 just before I write the pixel

#

which makes sense

#

the multiplier factors out

#

I don't get a similar effect to this

#

with the reflection changing

dense jacinth
#

otherwise what I’ve noticed is just slight changes in saturation or brightness, fairly similar to bluescreen’s sponza

#

if you have more complex light simulation I could very well imagine some effect shifting colors more drastically in BT.2020 in comparison with smaller colorspaces

winged veldt
#

ight then

#

i assumed srgb display

winged veldt
#

also the dragon color is different in mine, i made them saturated to test gamut, i'd have to try the original scene

dense jacinth
#

so might have the same issue here

winged veldt
#

i am converting my emission from srgb, so that shouldn't be happening

copper halo
timid frigate
copper halo
winged veldt
#

shouldn't make a difference though

#

iirc i'm just using the highest component

copper halo
#

well, that's wrong, for one

winged veldt
winged veldt
#

iirc what you use for rr doesn't matter

#

it's unbiased either way

#

so it won't change the results

copper halo
#

hmmmm

#

since you're biasing by the same value you roulette with, i guess?

winged veldt
#

ye

copper halo
#

try using real luminance tho

#

conv to xyz and yoink y

winged veldt
#

fuck no KEKW

copper halo
#

why

winged veldt
#

i can try lol

copper halo
#

you already have the code for that i assume

winged veldt
#

but yeah won't make a difference since it's unbiased

copper halo
#

unless you hardcoded rec 709 -> rec 2020 without going through xyz

dense jacinth
# copper halo wdym by this

in my renderer my sun was always just emitting (1,1,1) light regardless of color space, so having a different internal color spaces will obviously make the output change

copper halo
#

oh

winged veldt
dense jacinth
#

(another reason metal > glsl/slang/...)

copper halo
winged veldt
#

remember i have the option to change working space in the ui

#

it's not hardcoded 2020

copper halo
#

branch on bool lul

#

or just hardcode to 2020 because that's based

dense jacinth
#

yes

#

or use templated shaders

winged veldt
#

what's the problem with taking a matrix in the args buffer

dense jacinth
#
template<typename T>
kernel void bar(device T *x) { … }

template [[host_name("bar_int")]] kernel void bar(device int *);
template [[host_name("bar_float")]] kernel void bar(device float *);
#

do this but for color spaces

#

(this is just a sample from the metal spec)

winged veldt
#

but why agonyfrog

dense jacinth
#

why not

copper halo
#

oh i should make a col<T> type

winged veldt
#

cause it adds code complexity for no good reason?

dense jacinth
#

how is it more complex

#

your conditionals for switching color spaces just become if constexpr, and then the few extra lines of template instantiations

winged veldt
dense jacinth
#

ah true

winged veldt
#

i also don't have any hardcoded conversion matrices

#

they're calculated from the primaries and whitepoint, which gives me the flexibility to define any colorspace i might want

dense jacinth
#

well ok

winged veldt
#

probably not strictly necessary, but it's cleaner imo

dense jacinth
#

I just slapped the whitepoint etc. into an online calculator and then got my matrices

#

and mightve copied quite a bit from jaker

copper halo
#

you should render in the monitor's colorspace directly

winged veldt
#

why? there's no real benefit to matching the working and display colorspace afaik

#

better to render in as wide a colorspace as possible

copper halo
copper halo
#

hmmmmmmm how do you do autoexposure for HDR output?

#

my SDR autoexposure maps the average luminance to middle gray (~0.18)

#

but i need an output in nits thonk

winged veldt
#

no idea, i don't do ae

#

but you should be doing that in hdr anyway, no?

#

so ig it would still be the same

copper halo
#

you should, but that would map to 0.18

#

what is that in nits

#

for output

winged veldt
#

it should be half of the sdr range

#

hdr doesn't mean you should always use the full range, if the entire dynamic range of the image fits in sdr you display sdr

copper halo
winged veldt
#

good question KEKW

copper halo
#

lol

winged veldt
#

ask your monitor vendor

copper halo
#

what a monitor does when given an SDR signal doesn't really matter

winged veldt
#

i mean you'd want consistency between sdr and hdr versions of the same image ideally

copper halo
#

hmm

#

can't really get that

#

it's why HDR handling is so fucked

#

SDR isn't consistent in the first place

#

most monitors just have their own primaries, and ofc brightness can't be controlled at all

#

I guess that's what the 'paper white' settings in games is

winged veldt
#

i mean as far as brightness goes middle gray is just "half the max sdr luminance of the display, at the current brightness setting"

#

as for the primaries well just assume the monitor is properly calibrated, if it isn't that's a skill issue

copper halo
#

I guess I make that configurable

winged veldt
#

i mean you can calibrate output for the monitor's primaries ig if you know them

#

that's kinda what monitor calibration is

copper halo
#

technically EDID tells you

winged veldt
#

edid?

copper halo
#

display info

#

that the monitor sends

winged veldt
#

ah right

#

assuming it's correct forgderp1

copper halo
#

(it never is)

winged veldt
dense jacinth
copper halo
#

ooooh i can ask windows for the SDR content brightness and set my white point according to that

copper halo
copper halo
#

do you have any idea what any of his words mean KEKW

#

because i don't

winged veldt
#

if you read his articles it makes some kind of sense

#

the last few are totally unhinged though

copper halo
#

i have read them

#

i still don't understand shit

winged veldt
#

yeah took me a while and i still don't get some parts

burnt peak
#

he sounds like a weird guy and i want to imagine he was totally normal before getting into color math

#

I don't mean just that reply...

copper halo
#

color math more like just color

burnt peak
#

"not even once"

winged veldt
copper halo
#

oh new rabbithole

#

ABL-aware and mini-LED-zone aware local tonemapping

winged veldt
#

no thank you

#

i've been gone for a while cause uni semester started and i've been getting settled in but anyway

#

getting started with my jpeg lib

#

i've decided to just write a library so i can use it for other projects as well (and also because there's a distinct lack of simple image i/o libs that don't suck)

dense jacinth
#

fastjpeg??

winged veldt
#

so here's a jpeg

#

it's basically libjpeg hello world but hey it's working

#

now i gotta make it work with different input data types (int16, float32 etc) and figure out how icc profiles work so i can do colorspace stuff

#

then, ultra hdr support with the gain map thingy

#

oh and also be better at cmake so i can have the thing fetch and build libjpeg-turbo instead of relying on it being installed in the system (which it probably is because it's ubiquitous, but i'd rather not anyway)

dense jacinth
#

and then find a viewer that supports said icc profiles

#

or is Preview good enough?

winged veldt
#

ye, preview works

#

so does any web browser, afaik

#

arc (chromium) does indeed display p3 jpegs, so does safari

dense jacinth
#

ye but what about hdr

#

i mean even stuff like VLC can't fucking display HDR content on Macs

winged veldt
#

it just works™

#

i can open ultra hdr "jpegs" just fine in preview

#

and iirc works in a browser as well

dense jacinth
#

what does "ultra hdr" even mean here?

winged veldt
#

macos is actually like the one os where hdr is sort of sane

dense jacinth
#

well apple was very early on the hdr train

winged veldt
dense jacinth
#

ah yes ghetto solutions

#

love it

winged veldt
#

i've only skimmed the spec, but basically you have a container file with two jpegs

#

the first one is the actual sdr image

#

second one immediately follows and is a gain map

#

any software that doesn't support ultra hdr will just read the first, sdr jpeg and display it

#

however in that jpeg, the app1 marker has some metadata

#

that basically tells whoever is reading the thing "psst hey this looks like a regular jpeg but actually it's hdr, there's another jpeg with a gain map appended to the end of it"

#

that software is then supposed to read the gain map and compute the hdr values

dense jacinth
#

just use a normal format what the fuck

winged veldt
#

it's absolute jank but hey it works, degrades gracefully to a sdr jpeg, and is more widely supported than... uhh most hdr formats

dense jacinth
winged veldt
#

if this thing i'm making (i'm calling it simple_jpeg) turns out well i might make simple_avif or whatever

dense jacinth
#

i disagree

winged veldt
winged veldt
#

afaik stbi does the decoding itself and it's slowww

#

i'm just wrapping libjpeg and adding colorspace/hdr stuff

dense jacinth
#

ah okay

#

so not the #bikeshed-😇 NIH mindset

#

fair

winged veldt
#

not yet

dense jacinth
#

oh what about that other library

#

wait

winged veldt
#

i mean i want to actually make this thing and have p3/hdr output for my renderer, not bikeshed over the jpeg spec forever

dense jacinth
#

supports png and jpeg under one api

#

and is quicccc

#

oh wait nevermind

#

doesnt include encoders

winged veldt
#

it also has no docs bleakekw

#

and the c api is generated from their nih language thing

#

but yea decoding only iirc

dense jacinth
#

i remember it was quite easy to get started

#

heavy use of c++ in the api so it has to be good

winged veldt
#

it's a whole ass language they came up with

hazy zenith
#

They actually managed to achieve memory safety^tm

winged veldt
#

fake, it's not written in rust so it's obviously unsafe ||/s||

timid frigate
#

Blog also contains info about blackmagic luts for color manipulation

winged veldt
#

got icc profile embeds working, the left image is display p3 and right is srgb (they contain the exact same data not adjusted for color space, so the left one should be more saturated and clip differently on srgb displays)

#

now working on a minimal icc profile generator so you can write images in any arbitrary colorspace

#

turns out a minimal icc profile is pretty shrimple, you can basically just define the primaries and transfer function and that's it

copper halo
#

i realized something amazing today

#

for all the talk about colorspaces i do, my gltf importer doesn't import base color as srgb

old hollow
#

hey mate

#

you know you're on mac, can you give me your compiled dylib for imguizmo?

#

I can't figure out how to compile it and of COURSE there's no compiled binaries anywhere online

#

:C

#

@winged veldt :)))))

#

btw I did a cool thing I need to make a thread on community projects for my "engine" 😄

old hollow
#

also do you know why on mac, when going into fullscreen imgui looks sharp, but in a window it's slightly blurry, it's also breaking my fucking picking as the viewport pos I'm clicking doesn't align perfectly with the render texture faaack

#

like

#

in fullscreen it works perfectly

#

in window, it has a y offset so you can click top of an object it won't select but under the bottom where the object isn't it does

#

like by maybe 2-3 mm on my screen (13" screen)

#

😦

harsh sonnet
old hollow
#

I’m using OpenGL 🤣

#

Sorry for confusion haha

old hollow
#

It’s OpenGL via openTK

harsh sonnet
#

should probably move the discussion over to #opengl then

old hollow
#

Yeah mainly was asking bluescreen anyway

#

I know it’s to do with retina dpi

#

Like I have my Mac scaled to 2560x1200 I think it is

#

Which makes dpi scale 1

#

Going to recommended res makes the dpi scale 2 and my entire imgui drawing ends up cut into the top left quarter

#

Mac is strange like that

harsh sonnet
#

yeah retina layer scaling is a bit jank

old hollow
#

It also sucks for scalability when it comes to their ui, if you run at the legitimate max res

#

It goes tiny

#

Like idk I don’t understand if running native res makes it sharper I don’t think it does

#

Just makes the ui go tiny for everything

#

Retina is very strange yeah

#

But yeah I think what I need to do is derive the dpi scale from the openTK window and multiply my gl viewport with it

#

Btw @winged veldt tell me to go away if you don’t want me to message here 🙂

harsh sonnet
#

if you can get at the NSWindow that contains your application the relevant value is the backingScaleFactor ivar

#

which is always either 1.0 or 2.0 afaik

old hollow
#

Hmmmm I can calculate the dpi scaling anyway mate, using Size and Width/Height

#

Size is the larger of the two

#

Physical size ig

#

I just need to find the correct place to stick in the imgui windowing stuff

#

But I’m pretty sure it just goes in onresized

winged veldt
#

i don't know when that'll be, i've put my projects essentially on hold for a bit as life stuff happened

#

might come back to this next month, or whenever i have the time and regain motivation to work on it

winged veldt
#

how are you handling it?

old hollow
#

I’m not currently lol

winged veldt
old hollow
#

I wasn’t aware of Mac dpi

winged veldt
#

you're not supposed to do that

#

retina displays are designed for 2x scaling

old hollow
#

Yeah I run my Mac on higher res so like

#

It’s 1x dpi scale so when it’s that resolution it behaves

#

I don’t like how big everything is on the suggested res

winged veldt
#

right, you need to use the right scaling for imgui

#

you can check my code for it

old hollow
#

But I think i just need to add the scale factor for imgui when I do the resize event

winged veldt
#

though iirc i don't handle changing monitors so it might break if you have two displays with different dpi scaling settings

old hollow
#

Yeah I don’t plan to support Mac fully

#

Not until I pull the plug and use wgpu c#

winged veldt
old hollow
#

Yeah it’s just weird to me because it’s a Mac specific thing

#

Windows always runs native monitor res so

#

Unless you like blurry shit

winged veldt
#

you can set scaling and it defaults to 150% iirc in a lot of laptop displays

old hollow
#

It’s also doubling my res for the fbos when dpi scale goes up

#

Oh yeah but it doesn’t do this shit lmao

winged veldt
#

windows having major scaling skill issue is a separate thing

old hollow
#

Like what I mean you just don’t need to worry about your window size being different to pixel res on windows usually

#

I don’t do any dpi shit atm and had no problems with windows but mac it broke as soon as i changed res to test

#

But I may consider going to recommended res on Mac as it fixes the blurry imgui

winged veldt
#

yeah idk if windows handles it behind the scenes but mac does expect you to handle dpi yourself

old hollow
#

Yeah haha

#

It’s fun anyway

#

Also guess what

#

Metal being the actual api on openTK on Mac has its perks

winged veldt
#
/*
 * Scale fonts for high DPI rendering
 * TODO: should rescale on monitor change
 */
int renderWidth, windowWidth;
SDL_GetRendererOutputSize(m_sdlRenderer, &renderWidth, nullptr);
SDL_GetWindowSize(m_sdlWindow, &windowWidth, nullptr);
m_dpiScaling =
  static_cast<float>(renderWidth) / static_cast<float>(windowWidth);
old hollow
#

I can for the life of me get 10bit output on windows from my engine lol

winged veldt
#

that's what i do with sdl

old hollow
#

Yeah that’s all I need to do and then pipe in to imguicontroller.resized

#

Just scale gl viewport with the dpi

#

Basically anyway

#

Imgui resize in that controller does more stuff

#

Like ui mouse hit detection has to work with scaling too so

#

Will see if it fixes it when I pipe in the dpi scale

winged veldt
#

yeah you need to use the scaling factor in multiple places, input is one of them

old hollow
#

Yeah

#

I’m pretty sure tho

#

The imguicontroller does it

#

Simply by calling resize

#

It should get the pixel width then

winged veldt
#

what's the imguicontroller

old hollow
#

Height etc

#

Something from the openTK examples

winged veldt
#

ah

old hollow
#

It can do any imgui stuff

#

Btw when you do imguizmo mac

winged veldt
#

you're on your own with that, i don't even know what opentk is

old hollow
#

Let me know if you need to build the Dylib

#

Either way I would legit buy you a game on steam if you can give me the Mac lib for gizmo haha

winged veldt
#

i mostly statically link my deps tbh, but i'll share my cmake to do so

old hollow
#

It’s not in any nuget packages

#

Ah ok heh well if you could that’d be ace

#

I’ll treat you 🤣

winged veldt
#

i'll let you know when i do

old hollow
#

Thanks mate

winged veldt
#

no need for that lol

old hollow
#

What you been up to lately, this thread disappeared and I had to search metal path tracing to find it because I forgot the name haha

#

It fell off my discord pinned threads haha

#

Btw I’m not versed in c++ I only use c# - dynamic linking is when there’s a DLL and static is when the lib is part of your app?

winged veldt
#

yea

winged veldt
#

i do want to get back to this soon, though, there's a lot i want to experiment with

old hollow
#

Yeah, someone posting in showcase has some nice caustics idk if you’d be able to do that real time tho idk

#

Oh but then you aren’t doing real time anyway yet so

winged veldt
#

"yet" lol

#

i'm not even planning on it

#

least, not for this project—i might mess around with realtime rt down the line, but it's not in scope for now

#

though i do want to try implementing better light transport for caustics etc, starting with bdpt

#

just needed to get the colorspace crap out of the way first—i actually already have working jpeg output for display p3, so i think rather than adding support for arbitrary color spaces, cleaning it up and making it a library as i originally intended i'm just gonna integrate it into platinum and be done with it

old hollow
#

Ahhhh good idea 🙂 and yeah deffo would be cool to see caustics 🙂

winged veldt
#

yeah bdpt and volumetrics are the two things i most want to try out

burnt peak
winged veldt
#

i mean some day

#

but probably not any time soon

copper halo
winged veldt
#

or i might just tackle it now, idk

#

that was the plan, anyway

#

i'm just not too motivated to work on hdr when i'm missing a bunch of more important stuff, tbh

burnt peak
burnt peak
#

if that's what HDR is in this case... I think, assuming Rec. 2020 working space, it could just be something like

m1 = 0.1593017578125
m2 = 78.84375
c1 = 0.8359375
c2 = 18.8515625
c3 = 18.6875

def pq_inv_eotf(x):
    ym = pow(x, m1);
    return pow((c1 + c2 * ym) / (1.0 + c3 * ym), m2)

rec2020_lin_val = transmittance * some_projector_brightness
pq_val = [pq_inv_eotf(ootf(x) * (paper_white_nits / 10000.)) for x in rec2020_lin_val]```
#

in theory, projector brightness could just be a, uhh... HDR-ness control knob of sorts, with radiance extremes already reined in

burnt peak
#

or - wait, you're doing apple stuff, right? I guess they have their own display p3 thing?

winged veldt
#

yeah, haven't looked into hdr output

burnt peak
#

wikipedia says dci uses pq, but apple is .... apple, so I have no idea

winged veldt
#

it's probably pq

#

oh good, a new version of openimageio broke the project

#

i hate image libs so much

burnt peak
#

errr... I dunno

#

I've had nothing but trouble with oiio

#

I guess they use PQ for consumer stuff anyway.

winged veldt
#

but what image i/o lib isn't

#

stb is simple but horrendously slow and only really handles jpeg and i think png

burnt peak
#

python's imageio is mostly decent, but I'm guessing that doesn't help you

winged veldt
#

oiio is pretty solid and supports a lot of formats but it's a major pain in the ass to build and/or link hence why i end up relying on it just being installed on the system

burnt peak
#

pain in the ass to use too

I'm not a fan of their docs or API, IIRC

winged veldt
#

but then apparently they make breaking changes on a patch bump and my code no longer compiles against it (3.0.4.0 vs 3.0.1.0)

winged veldt
#

the docs are kinda ass but at least they fucking exist lmao

#

stb has some comments in a header file, wuffs has literally nothing

#

might just deal with libjpeg, libpng and libexr directly, i'm already switching to libjpeg for output to support color spaces

#

but also i wish writing images to a file would just get out of the fucking way, because it's very boring code to write and has nothing to do with what i actually want to do (rendering)

burnt peak
#

I don't know. I find it very sparse and lacking options where it should be detailed and explicit and very thorough everywhere that idgaf.

winged veldt
#

i just haven't found any better

#

for c/cpp at least

burnt peak
#

the state of image io in general strikes me as surprisingly raw and immature-looking for how ancient and fundamental it is to just about anything

#

not the library, but just all of it

winged veldt
#

yeah you'd expect there to be at least one decent lib for it by now

#

honestly, i might just extend my libjpeg wrapper to input, add support for png and exr, and forget about image io libs

#

i don't want to spend the next month writing image i/o code, but it might be easier long term

burnt peak
#

like, even in python, which is reputed to be largely plug-and-play for most things, I've concluded on several occasions that the most appropriate image format is a raw binary dump

#

because there's always something... tiff API is broken, EXR is corrupted on linux, etc, etc, etc

winged veldt
#

ppm is unironically the best image format

burnt peak
#

PIL/Pillow is beyond help

#

that's like... too far the other way.
API simplified to the point that you get a fisher price image library.

#

"save this for interwebs and I don't care how"

winged veldt
#

yeah i'm convincing myself writing a libX wrapper is the way to go

burnt peak
#

reading a little more about HDR standards now I would like to reaffirm my position that the whole thing is unhinged and improvisational

hazy zenith
winged veldt
#

why

#

the little i've seen of the spec seems alright

timid frigate
hazy zenith
#

And libtiff's source code is... one of the worst I've read. Like no wonder the thing gets CVE's almost every year.

#

It's the first codebase where I've seen the register keyword used. It's that ancient bleakekw

#

I don't think the format does anything particularly well.

winged veldt
#

if you're gonna have the code be the spec at least make the code good bleakekw

winged veldt
#

tbh so are jpeg and png but we're still using them

winged veldt
timid frigate
#

For save png I use lodepng. Works slow but good compress

winged veldt
#

i'm just gonna use libexr and libpng directly in my own abstraction

hazy zenith
#

Or you could convert all textures to QOI with a cmdline tool ehehe

dense jacinth
#

since tinygltf I am quite scared of “tiny” libs

timid frigate
winged veldt
#

i'm making my own shitty library instead

timid frigate
timid frigate
winged veldt
#

i'm probably just going to write a wrapper around libexr/libpng/libjpeg though, unless they're bad enough i actually go fuck it, i'm doing it myself

#

but i really hope it doesn't come to that because i don't actually want to write image i/o code

dense jacinth
#

well to be fair I would rather write a wrapper around that thing google made

#

forgot the name of it

dense jacinth
#

yes wuffs

#

use wuffs as much as possible is what i'd say

#

and then use other libraries for the things it doesnt support

timid frigate
#

wuffs scared @winged veldt 🤣

dense jacinth
#

🐕

winged veldt
#

so that's a no from me

dense jacinth
#

you need decoding for importing no?

#

and it is documented I am fairly sure

#

or use my code as documentation

winged veldt
dense jacinth
#

what difference does it make

#

there's gonna be two separate code paths regardless

winged veldt
#

if whatever i use for encoding decodes as well might as well just use that, reduce the amount of dependencies

#

yeah, i know wuffs is fast, but i'm not decoding png in a performance critical context anyway

winged veldt
#

honestly the whole thing is just confusing as hell to me, every time i've looked at the repo i just have no idea what's going on

dense jacinth
#

yeah true

#

I just use it because I don't need exporting, and it is safe and fast

#

basically my entire graphics programming endeavours boil down to having the fastest possible asset loading times

#

never got to the graphics part KEKW

winged veldt
#

yea, i do need exporting and don't care about safety or speed (within reason, stb is just too slow)

#

though honestly i'd just use stb despite the slowness if it had the features i need

winged veldt
#

i wish more libs were like that

burnt peak
dense jacinth
#

uh for graphics that's about it

#

I had a raytracer back in the day which didn't converge correctly and had broken diffuse shading, I had a Vulkan mesh shader renderer that just put triangles on the screen, I had a Metal mesh shader based renderer where I actually managed to get cascaded shadow mapping in, and I had a Metal based mesh shader based renderer with a basic VSM impl that borked the drivers and Xcode

#

I think that's about all I've managed to achieve 👍

#

oh and I've done MVK work

#

it's all just random garbage basically

#

besides my libs

hazy zenith
#

tinyexr is not great tbh

#

I use it in my renderer and would like to replace it eventually.

timid frigate
hazy zenith
#

I had a problem with outputting images in XYZ iirc.

winged veldt
#

WE'RE SO BACK

#

i got the thing building again, without relying on clion now just plain cmake+make

#

yeeted oiio, added tinyexr for lut loading

#

just need to bring in a png lib to bring back texture loading and render export and i can start working on it again

bronze sedge
#

what's that ui?

#

looks aaaaamazing

winged veldt
#

imgui froge

#

a nice font and a bit of custom theming goes a long way

#

it supports a light theme as well

bronze sedge
#

damn

#

doesn't look like imgui at all

#

btw I meant the whole render and everything looks amazing

winged veldt
#

thanks frogeheart

#

it doesn't have a huge number of features, but the basics should be solid

bronze sedge
#

do you like argentinan bbq

winged veldt
#

once i get everything working again i want to get volumes in

winged veldt
#

asado is the best

bronze sedge
#

are you in buenes aires?

winged veldt
#

yup

#

like a third of the country's population KEKW

bronze sedge
#

I was thinking of visiting clarolab team

#

the flight is like 14 hours or something :S

#

it's crazy though 14 hours and very little jet lag

#

because the direction is north to south

#

my brain has a hard time with that

winged veldt
#

i'm used to them lol

#

flight to europe is about the same time

#

you should visit, it's a cool city

#

if you have the time travel around the country while you're at it

bronze sedge
#

that sounds nice

winged veldt
#

hdri loading is back in, now supports exr (with tinyexr) and hdr as before with good ol' stb_image

#

uh oh my glass may have a little nan problem

bronze sedge
#

oh

#

interesting though

winged veldt
#

so the only thing that changed is the lut loading

#

and the other materials work fine, so it's gotta be some issue with the 3d luts the glass material uses

hazy pelican
winged veldt
#

i think tinyexr might be ass

#

it can't cope with single channel exr files, just spits out rgba data so now i have to process it instead of doing a memcpy to a buffer

#

got it working, we're so back

winged veldt
#

gltf import is back, i now just fall back to stb_image for texture loading because it handles different formats seamlessly (unless it's exr, then it uses tinyexr)

#

it's slow, but whatever, i'll just multithread asset import later

winged veldt
#

p3 output works 🎉

#

if your display is srgb those two images should look exactly the same, but if you have a p3 display (and an image viewer that's properly color managed) the walls shold be way more saturated in the left image

quick zealot
#

Suurrelly Discord is an image viewer that's properly color managed

winged veldt
#

actually, yes

quick zealot
#

no waydge

winged veldt
#

it's chromium which handles color profiles fine

quick zealot
#

nice

winged veldt
#

well on macos at least

quick zealot
#

So what's next now that the image IO stuff is sorted out?

winged veldt
#

uhh i still need to fix the lut export i think then i'm done

#

i mean

#

not that i'm using it anymore, but i do want it to work

#

i think ima add support for volumes next

#

simple beer's law first, but i want to do it in such a way that it supports proper volumetrics as well and not just the ugly hack yart had

#

which does mean messing around with the renderer architecture a bit, because now i'll need to actually track what medium rays are in

quick zealot
#

Yeah the RayVolumeState is quite a bit of a feature creep in my renderer, you always have to bring this one along in many places because there are many places where you may want to know if you're inside a volume or not, it's a bit annoying

winged veldt
#

yepp

#

i'm probably just gonna like

#

make it a global KEKW

quick zealot
#

May not even be a bad idea

winged veldt
#

keep it as shrimple as possible

quick zealot
#

I suspect my RayVolumeState is spilled to gmem anyways because of how long its lifetime is

#

So having it in gmem just simplifies the variable passing a bit and may not even be slower than having it in (spilled) registers

winged veldt
#

i'm not too familiar with memory management on the gpu

#

it would still be thread local ofc

#

just a global in the sense that i'm not passing it around as a parameter all over the place

quick zealot
#

thread local because each thread wants its own state but by "global" you mean in an SSBO?

winged veldt
#

the fuck is an ssbo

#

i don't speak opengl

quick zealot
#

shader storage buffer object

#

just a buffer

#

like the one you store your materials in

winged veldt
#

oh

quick zealot
#

and geometry indices and whatnot

winged veldt
#

no need for that though

#

i don't need that data cpu side

#

i'm talking about literally just a global variable in the shader

#
thread RayState *rayState;

done

quick zealot
#

Ah so it behaves like a local variable just that it's accessible everywhere?

winged veldt
#

ye

#

i mean i'm pretty sure msl does let me do that

quick zealot
#

I see

winged veldt
#

if it doesn't i can just pass it around whatever

quick zealot
# winged veldt hm wdym

then:

Basically the ray volume state is created at the very beginning of your kernel (where you ray is created)
And you have to keep it around until the very end of the kernel when your ray exits the scene / has bounced the maximum number of times

So the ray volume state exists from beginning to end. That's why it's lifetime is long.

The few cosine terms and contribution terms when evaluating NEE for example don't have a long lifetime because there only there for a few lines of code and when you exit your NEE(), these variables are "freed" and registers allocated for them are also freed

The ray volume state is never freed, from the beginning of the kernel to the end. And big-ish variables / structures that have long lifetimes like that are often spilled by the compiler ime to save on vector registers usage

winged veldt
#

right

#

yeah in that case it's probably getting yeeted to vram

#

i honestly don't think about that too much

quick zealot
#

probably yeah

winged veldt
#

how many registers does a gpu have

quick zealot
winged veldt
#

wait how

quick zealot
winged veldt
#

oh that's a completely different ballpark from like cpu registers

quick zealot
#

oh ye

winged veldt
#

are we even talking about the same type of thing

quick zealot
#

yes

winged veldt
#

huh

quick zealot
#

it's just GPUs have a massive ton to allow for ultra fast context switching basically

winged veldt
#

how does that not make the chips chungus

quick zealot
#

because the rest of the GPU core are quite small compared to a CPU core, that's why GPU cores are way slower on their own than a CPU core

quick zealot
winged veldt
#

multithreaded convo

quick zealot
# winged veldt also, what was causing this?

Because the BSDF code is so massive that it requires a ton of registers. So many that tons of registers are yeeted to VRAM.
And I suspect (haven't checked the assembly though) that the registers spilled to VRAM are the ones used in the eval/sample function of the BSDF

This makes the eval/sample functions super slow because they're pretty much operating on VRAM instead of registers lol. That's a bit of a simplified way of saying that but that's the idea

And so the difference between

  • a Lambertian BRDF
  • my Uber BSDF with all materials using parameters such that only the diffuse lobe is evaluated

is 2x in perf

winged veldt
#

huh

#

how big is your bsdf

#

mine is kinda chonk ngl

quick zealot
#

Quite big, it's almost a full OpenPBR impl basically. It's around 2.5k lines I'd say, 8 lobes

winged veldt
#

i've thought about using metal's fancy compile time branching thing to build specialized shaders for each material before rendering

#

might do that at some point, see what it does for perf

#

would also eliminate a lot of branching in the shader

quick zealot
#

Yeah I think the best way to go for me at this point is wavefront path tracing + material sorting + specialized shaders such that it only compiles the shader code that is exactly needed for the material being path traced: do not compile the chonky glass lobe / thin-film interferences / double-metal / ... if the material is just specular + diffuse

#

I think doing this could be really good for registers (and thus perf)

quick zealot
winged veldt
#

yep

#

i'd have to figure that out lol

quick zealot
#

the thing that worries me a bit with wavefront path tracing is that it doesn't like path guiding 🙁

#

or path guiding doesn't like wavefront

normal solar
#

in chrome browser

#

works as is

#

why do my photos I send from phone never have hdr previews though

#

if you could get p3 to show up

winged veldt
#

hdr images only show in hdr when i zoom in for me

#

well shit

#

just tried to render intel sponza and it froze the entire os agonyfrog

#

this worked before

normal solar
#

though I do wonder why entire os has to die

winged veldt
#

likely something the gpu driver didn't like

#

i had full os crashes before when i had like an infinite loop in the shader or something

copper halo
#

have you tried getting a better driver/os

winged veldt
#

shut

copper halo
winged veldt
#

ok yeah i'm definitely doing something to lock up the gpu

#

the question is wtf is it

copper halo
winged veldt
#

intel sponza rendered fine before and not much changed

#

well uhh

#

the old build also crashes

#

and if i import the gltf instead of loadin gmy old scene it renders fine

#

what the fuck

copper halo
#

gippy yous froge_love

winged veldt
#

gippy moment

#

sponza now with curtains, ~5 min at 4k samples

#

i should actually do stuff lol

#

anyway nice to have this functional again, and exporting in p3 too

copper halo
#

rec2020 smh

winged veldt
#

i technically support 2020 export

#

do you have a 2020 display

copper halo
#

uh

#

sorta

winged veldt
#

exactly KEKW

copper halo
winged veldt
bronze sedge
spice frost
#

👀

#

i was planning on moving onto volumes right after doing mis

#

we can be volume buddies

copper halo
#

no point doing NEE if the brdf is perfectly specular?

quick zealot
#

Not doing NEE on emissive materials? What is this biased felony thonk

winged veldt
winged veldt
#

i think it used to be a separate lobe with a nonsense pdf, so i skipped nee if i sampled the emissive lobe

#

but then i merged it into diffuse so it should be fine

keen bear
#

Not the entire bxdf

#

Which is my point

#

Your bxdf might have both specular and diffuse components

#

But if you picked specular component when sampling you won't do nee

#

Even though it would still be beneficial??

#

Because there's diffuse component

winged veldt
#

yeah that's a good point

keen bear
#

Pbrt snippet I linked shows this btw

#

They have a flags method on bxdfs

#

That returns flags of all components basically

winged veldt
#

ye just saw that

#

interesting

keen bear
#

That contribute to bxdf eval

winged veldt
#

i'll try fixing that later today, cause i think i do have some missing energy from just that type of material

winged veldt
#

thanks for pointing that out btw

keen bear
#

Ye np

winged veldt
#

i probably have countless issues in my mis and bsdf code agonyfrog

keen bear
#

I'm dumb at light transport, I'm soaking things up from pbrt but I'm looking at your code for how do you organize things

#

Btw you should add programmable materials

#

It makes everything at least 10x more fun

#

Sampling is as easy as before tbc but you get more plumbing to piece together

winged veldt
#

my bsdf is probably a mess so feel free to keep pointing out anything wrong/shitty code it helps

winged veldt
keen bear
#

Alr

winged veldt
#

like blender's node based thing?

keen bear
#

Yeah

winged veldt
#

yeaa i'm skipping that for now nervous

winged veldt
#

@keen bear removed the condition on light sampling, doesn't seem to make any visual difference in the render 🤔

#

but maybe it'll help convergence on a more complex scene

#

it's certainly more correct, though

#

i've changed it to just the bsdf itself not being fully specular (either roughness >0, or metallic+transmission < 1 so it has a diffuse component)

#

also i clearly have a major firefly problem

#

i suspect something in my bsdf is bad

keen bear
spice frost
#

i'm getting fireflies too with your scene despite only having diffuse materials

winged veldt
#

hmm, doesn't change anything, so i don't think it's that

#

the light is double sided yea, but it's just two tris

#

so if it gets sampled you can't sample one specific side, if that makes any sense

#

if a ray happens to hit the top—or sample the light from the ceiling then yeah it'll hit the backside, but that should be no problem

#

though that does make me think if a sample at grazing angles might be causing fireflies with some insane pdf due to numerical instability

spice frost
winged veldt
#

well any ray that hits the ceiling will sample that light

#

hm

spice frost
#

before vs after moving the light

#

and yes i still haven't fixed it KEKW

winged veldt
#

hm, there may be multiple sources of fireflies

#

you have way fewer than i do

#

how many samples is that btw

spice frost
#

the left was 15k i think, but honestly it was getting worse over time

winged veldt
#

changing the light to a sphere should minimize grazing angle nee hits, but does little to reduce the fireflies

spice frost
#

you're right it isn't many fireflies

winged veldt
#

lmao i'm doing like 250 samples

#

15k takes forever

#

lemme just do a lower res render

#

uhhh yeah 2.5k and counting, i definitely have waaay more fireflies

#

i don't have a pure diffuse brdf to test with though

#

i would hope i don't get fireflies with that cause it's super shrimple

spice frost
#

could also be caustics maybe?

winged veldt
#

don't think so, it's consistent across almost every scene even without shiny materials

spice frost
#

made a new material by mixing metallic with diffuse just for testing and yeah, it's noisier but still not comparable to yours

winged veldt
#

yeah ima try to figure out what's causing all the fireflies

#

ugh

#

i wish i could write my shader code in a real language

#

fuck shading languages

#

not having any lsp support or even syntax highlight in my editor sucks absolute ass

spice frost
#

true...

#

time to write shader debug printfs all over the code KEKW

winged veldt
#

that's not even the issue, it's the complete lack of syntax highlight

#

tbf there are lsp implementations for glsl and slang

#

cause people like actually use those

#

msl is a pain in the ass to work with because there's zero support outside of xcode

#

and i'm not using xcode

#

tbh when kosmickrisp enables vk rt on mac i'm probably rewriting this thing with a vk backend

#

funny enough clangd_format actually works just fine with msl because it's just c++

#

but the clangd lang server shits itself with all the custom keywords and doesn't find the include dirs

spice frost
#

so you're basically coding in plain text? that does not sound fun

winged veldt
#

yeahh

#

i did manage to enable nvim's basic syntax highlight so i can at least tell keywords, comments, and numbers, but that's about it

keen bear
#

honestly your codebase seems small enough that a shrimple text editor, maybe with syntax highlighting + git grep is fine no?

#

I do struggle slightly without go to definition on larger codebases but these tools also often fall apart on the said larger codebases

#

like e.g. vscode's go to def in linux (the kernel (the sorse)) often lands me at incorrect definitions so I have resort to git grep again

#

it works slightly better with mesa but our driver does some cursed macro magic (there's other drivers that do the same thing) that vscode doesn't cope with and so I'm often back to using git grep again

#

I guess it's just a cee moment (similarly applies to c++ ofc)

winged veldt
#

but without lsp support the syntax is kinda ass

keen bear
#

lol I wish clang-format was actually good and we had ci require that things are formatted

winged veldt
#

what's wrong with clang-format

#

other than being kinda tedious to configure

keen bear
#

doesn't format designated init well too well imo

#

but it's a minor complaint

winged veldt
#

this is what nvim basic syntax highlighting looks like

#

better than plaintext but barely

#

and no autocomplete agonyfrog

#

i mean clangd should work on msl with a little trickery

#

if i could just get it to see the include paths

keen bear
#

I don't get autocomplete at work froge_bleak

#

well

#

it works sometimes

#

the other times it's borked

keen bear
#

because of the cursed macro magic

winged veldt
#

oh

keen bear
#

leme show lmao

winged veldt
#

oh no

#

fwiw xcode's autocomplete is also broken

#

so the situation is not better using apple's own stuff KEKW

keen bear
#

when I worked as an ue monkey vs proper (i.e. not vscode) would also be broken a lot

#

so I had to use,, you guessed it, git grep

#

for ue

#

yes

#

and ue code is NOT straightforward to navigate

winged veldt
keen bear
#

god I love when my sbc randomly reboots for no reason

#

alright I give up I'll boot into stable kernel

#

probs something is borked in kernel with my changes

#

so uhh to give you the first impression

#

vsc doesn't believe this is a function (but it is)

winged veldt
copper halo
#

i'm working on UE rn and clangd works almost perfectly tbh

keen bear
#

autocomplete? yeah sure buddy

copper halo
#

all the UHT macro spam resolves fine too

winged veldt
#

btw do you work on gippy drivers?

keen bear
#

works elsewhere though

winged veldt
#

cool

keen bear
#

with panvk_per_arch and bunch of other things substituted with names identifying the arch

winged veldt
#

only similar issue i ever had at work was certain libs murdering the ts language server

copper halo
keen bear
#

I'm not a fan of this approach tbh but the other extreme is doing things like radv does and I feel like that's worse

#

in drivers using genx approach (like the above), the hw stuff is represented with structs

#

in drivers like radv which don't have this cursed macro magic things are arguably more tedious, you put things into bags of uint32_ts or w/e by yourself, shift and mask bits around, etc

#

anyway back into the kernel mines I go,,

winged veldt
#

so either way you don't get typechecking lol

keen bear
#

it's just that fancy tools fall apart

winged veldt
#

well yea at compile time right

keen bear
#

hopefully eventually things get rustified at least a lil

#

(and hopefully it won't be taking morbillion years to compile, as many rust codebases seem to tend in that direction)

copper halo
#

and 70% of a 64 core threadripper froge_love

keen bear
#

my work laptop has 16G soldered I'm suffering

#

I got 48G for gf so she can have morbillion layers in krita

#

but I myself continue suffering

copper halo
#

i had a work laptop and it was too slow so they sent me a workstation KEKW

keen bear
#

I compile stuff on the sbc

#

easier than cross compiling frognant

#

and the sbc is fast enough for compiling linux and mesa (though not vk validation layers, or vk cts, those are too chungus)

copper halo
#

i need the threadripper and UBA to compile in a sane amount of time

#

(still takes 20 min when i get a new build)

keen bear
#

the only downside is that it has an nvme and in summer nvme would get so hot in some workloads it would trip the thermal fuse

#

so like yeah

#

it would throttle the soc down into oblivion but it would still not help because even fully throttled cpu is fast enough to feed nvme with enough work to blow past whatever is the thermal threshold

copper halo
#

still, your iteration times seem a lot nicer than mine bleaker_kekw

keen bear
#

in certain workloads

#

yes

#

I hate C++

#

I did some work on ANGLE in the past

#

it was pain

copper halo
#

my iteration times suck less because of c++ and more because of UE

keen bear
#

well in case of ANGLE it's also down to how ANGLE uses C++ but ime a lot of C++ codebases just tend to have horrid compile times

#

so unless there's additional knowledge/assumptions, I prefer to avoid working with C++

#

but yeah UE also has this uhh

#

the last time I touched UE was in 4.26 times or something

#

I do recall there was a weird step before actual compile taking like 10-20 seconds and barely utilizing the hw

copper halo
#

UHT?

keen bear
#

I guess so idk

#

but yeah I did not find UE pleasant to work with

copper halo
#

UHT takes a bit for me on full rebuilds yes

#

but incremental is fine

keen bear
#

also my workstation at the time was i7 6700 (non-k) iirc

#

though when I moved to wfh I got 5900x

copper halo
#

ok that explains it

#

local compiles are just unfeasible no matter what you've got

keen bear
#

5900x was p good tbh

#

though

#

I do feel like windows was making an impact on compile times

copper halo
#

ok actually i have to compile the engine 4 times, so uh

#

might be better if you don't

keen bear
#

I remember git grep being noticably slower on my 5900x with nvme ssd running windows than on my laptop with i5 6300U with sata ssd running fedora

#

I think I had to tinker with windows guard or w/e it's called to make things not garbage

#

but ofc it became the fastest when I stopped being an ue monkey, wiped windows and my 5900x became busy running linux instead of windows

hazy pelican
keen bear
#

@winged veldt have you considered getting rid of LightSample::pos in favor of dist or smth

#

so pos would be equivalent to hit.pos + LightSample::wi * LightSample::dist

#

infinite lights like env light could specify dist = inf

#

so then the code that handles light sampling would do min(ls.dist, max ray dist or w/e)

#

in my toy program I also decided to factor out Li into its own function because Li will become non-trivial to compute once materials are wired into the lights so it'd be preferrable to only compute Li if the point has been hit

winged veldt
#

over what i have now

keen bear
#

your infinite light code assumes max ray length

#

of 100 rn

winged veldt
#

oh ye lol

#

i forgot about that

keen bear
#

that way you could push it onto the whatever is doing light sampling

winged veldt
#

yea i should just use dist=inf

#

and no limit for max ray length

keen bear
#

do you plan to make emission value be defined by a texture

keen bear
winged veldt
#

yep

#

hm yart had that did i not port it over to platinum yet

#

i frogot it's been a while

#

but yeah i'll make li a function if it gets any more complex

keen bear
#

but you can know the scene bounds

#

which'd be effectively inf ig

#

and arguably lights should not be the ones handling that

winged veldt
#

at least in metal

keen bear
#

inderesding

winged veldt
winged veldt
#

which is effectively infinite

keen bear
#

I guess yeah

winged veldt
#

yeah i'll keep that in mind it'll be cleaner

#

rn i'm trying to find what's causing all the fireflies

#

i want to improve overall render/code quality

copper halo
winged veldt
#

like disable lobes?

copper halo
#

no straight up disable chunks of the code

#

just output D, G, blah blah

winged veldt
#

oh

#

last time i did that i didn't find anything weird

#

but it's been a while

quick zealot
quick zealot
#

Also @winged veldt , what if for GMoN we could look up the neighbor pixels to get more sets for not more VRAM?

Each pixel does 3 sets

And for computing the median of means, we could look at say the pixel to the right, left, above, below to add 12 more sets

That deviates a bit since neighbor statistics aren't the same as center pixel statistics but with pixels this close, this could work very well?

keen bear
#

@winged veldt when switching to spherical trongle sampling,,

winged veldt
#

uniform solid angle sampling?

keen bear
#

ye

#

for area lights

winged veldt
#

i don't understand it tbh, brain too smooth agonyfrog

keen bear
#

mood

winged veldt
#

i read the pbrt stuff and it was so much code just to sample a tri

#

i tried to implement it in yart (my earlier cpu path tracer) and gave up agonyfrog

#

if you know of a simpler implementation i can look at that would be super helpful tbh

#

i've since learned a lot of pbrt code is overcomplicated and hard to parse

keen bear
#

that's true

#

I don't like pbrt's light sampling interface for example

#

there's too much data in the light sample and it also has different interfaces for infinite and finite lights instead of unifying the two

winged veldt
#

yeah i don't like pbrt much in general, the book is great for theory but the code is way bloated if you're trying to figure out the concepts

keen bear
#

yea

winged veldt
#

also that seems closer to that other method for yeeting fireflies that's mentioned in the gmon paper

bronze sedge
#

What is a spherical triangle. Three non-collinear points form a plane

keen bear
#

trongle projected onto a sphere

bronze sedge
#

Oh wikipededia explains

#

Cool stuff

winged veldt
#

neat, treesitter will happily highlight msl as if it was c++

#

so even if i can't get clangd to work, i at least get syntax highlighting and formatting

bronze sedge
#

that's sweet

quick zealot
winged veldt
#

hm

#

possibly, but vram usage isn't my main concern with gmon

#

it's the effect it has on caustics and darker areas

quick zealot
#

Ah I see

#

How many sets do you use? I tend to use only like 5/7

I'd rather have a tiny bit of fireflies (but even with only 5 sets they are extremely mild) left than massive darkening because of using 21 sets or something

#

I think RWMC darkens a bit less than GMoN but still a little depending on the variance if that's a solution 😅

#

Or just get a better GI / caustics integrator KEKW

copper halo
#

"shrimply git gud" is always the best idea

winged veldt
#

debug the bsdf and integrator to see what's causing the fireflies

#

as for caustics i do eventually want to add bdpt, path guiding and such

winged veldt
#

nope, haven't had time for it

winged veldt
#

i mean good news is, probably not a mis bug

#

bad news is, probably a bsdf bug KEKW

#

the fireflies look worse in the mis+nee renders but that's mostly because the noise floor for naive is much higher so they're less obvious, but i think they're just as bad

winged veldt
#

here's a set of "control" renders i'll be using to test the firefly stuff

#

cornell box renders are 10k spp naive and 1k spp mis+nee, veach lights thingy (turned out to be a great scene to expose fireflies) is 20k spp naive and 1k spp mis

winged veldt
#

alright test 1: replace the entire bsdf with a simple lambertian diffuse

#

absolutely no firefly issues in the naive renders as one would expect (the veach scene is super noisy ofc, it's literally designed to be a bad case for a naive path tracer)

#

mis renders are showing some fireflies though, especially visible in the veach scene

#

but also some in the dragons and even the basic cornell box has some brighter pixels in the small box closer to the camera if you look closely

#

so there are mis issues, i'll go ahead and fix those first

#

oh now i remember why i had it set to skip nee if the last hit was emissive @keen bear

#

i suspect what's happening here is ray hits a light -> nee ray samples the same light -> distance is near zero, numerical instability causes the sample to blow up

#

which i fixed by simply skipping nee if the hit was on an emissive material, idk if there's a better way there probably is

quick zealot
#

If anything, enabling MIS usually fixes some fireflies for me with everything Lambertian, probably because the BSDF sampling helps in some places where NEE is unstable

winged veldt
#

i gotta eep now, but i'll keep looking into it tomorrow

quick zealot
#

I'll try see if MIS adds fireflies for me or not

#

that was on the dragon scene?

winged veldt
#

the veach test one

#

it's not mis vs no mis, btw

#

i'm always testing mis+nee

#

i don't have a nee only integrator

quick zealot
#

so what's on the right?

winged veldt
#

no

#

right is mis+nee without skipping nee on emissive hits