My third path tracer project and first one using the GPU. Also features a GUI scene editor and, soon, custom scene format.
Initially named metal-pt, then renamed platinum because it's a metal with symbol Pt, and also a cooler name.
#Platinum — Path Tracing in Metal
1 messages · Page 1 of 1 (latest)
NOO WAYYYY
Actually cooking
Oh shit indirect goes brrrr on the second screenshot
what are EVs by the way for the exposure?
Effort values?
Min-maxing pokemons?
ye, it's a bit noisy even at 2k samples because backwards pt isn't great at indirect but it's looking pretty good
that one is at +6.7EV
first one is about +5 i think
oh
i just have a scalar for my exposure control, no "EV" thingy
actually not sure what ev stands for but it's stops of exposure
+1ev is double the light
you just multiply by exp2(exposure_ev)
hmmm okay I see
so yeah -11EV was a lot earlier hehe
yeh it's like 1/2048 lmao
but then that's *32, that's also quite a bit
6 and 2/3 stops is also a lot, but not unreasonable
what does it look like with EV 0 ?
yeah
5 stops is about the difference between direct sunlight and bounced light in daytime
if you ever wondered why getting nice photos in sunny weather is fucking hard, that's why
the sun is bright
That's blender, it looks okay without any exposure modification
But i guess exposure tuning is purely artistic control no? Like, there's no "correct" image and it's all about what looks good or not?
Also Blender sweating a bit with the indirect lighting noise in the first few samples (100)
0 and +2
yeah mine also looks awful at 100 samples heh
How does Blender "get it right" automatically? Auto-exposure? I haven't seen a feature like that in Blender though
honestly idk
the thing about the ev scale is it's relative
so "0ev" is not some kind of absolute value, just means whatever your sensor picks up
it's there actually but default values just work 🤷♂️
iirc there is an "absolute" lv scale where direct sunlight is something like 14lv
in terms of exposure in a real camera that usually corresponds to about 1/250s f/8 at iso 100
oh and then you can do everything relative to the sun?
yeah you sorta use that as a reference point
but for rendering your values can be pretty much anything
as long as they make sense relative to each other you can scale as much as you want
yeah the odd thing is it looks about the same for a cornell box with the same light intensity too
so maybe they are doing some kind of auto exposure or they just handle env maps different
PlatinumSrc 🤝 Platinum
Just tried path guiding in Blender also, for fun, to see how much it helps
First is 256SPP no guiding. 2min09
Second is 256SPP with path guiding (all samples both used for training and rendering). 2min39
Third is no path guiding but equal time with path guiding (2min44)
damn, gotta get myself some path guiding
Looks awesome 🙂 does it run on any apple silicon Mac? Even M1 Pro? Send a demo over when you have something and I’ll have a go
Also in case no one said, afaik EV just means exposure value
But idk it’s been a while since I did photography heh
thanks! should run on anything that supports metal 3, which i think includes all apple silicon gpus
Ahhhhh yeah mine supports metal 3
i don't have a binary, but here's the repo link, you can try building if you want: https://github.com/teofum/platinum
Also it’s crazy how my Mac can get almost as good fps on my renderer as my pc with a 4070 in it
Xcode?
yeh
Ok mate I’ll have a try
sadly lol, but the metal debugger is a must have
i think the only dependency you'll need actually installed on your system is openimageio
Ah ok
cause it's an absolute pain to build and link from source 
Did you see my shadows btw in #wip
Haha yeah fun
You’d have to guide me I use rider never done shit with Xcode only have it installed because it’s required for ue5
yee looking great! do you have a project thread for your renderer? realtime right?
Not yet and yeah real time
I wanna switch from openTK to silk.net
Because it supports dx12
😄
i only switched from clion because of msl support and the debugger (though tbh i could attach the debugger to a running process but it's not as nice)
I was tempted to install that Mac specific Linux distribution on as a second os
i have a pc but my mbp is more powerful anyway
Forgot the name but where Mac OS stops gl support > 4.1 this has 4.6 and vulkan 1.3
asahi? lmk if you do heh, could be good for testing stuff
Heh which MacBook you go yeah I mean that one mate
don't think they support m3 yet, though
it's c++ btw, using metal-cpp
the driver one 
Was it Tiny? Idk if it was yours that had that in one of the messages
Ah 🤣
Hah
Btw for my gl renderer
I wanna do hierarchical culling
though i have wondered if it's possible at all to custom build a bvh and give that to metal's hw rt api
So parent gets its bounds tested if it passes and should draw don’t bother testing stuff lower down the chain
My frustum culling on a scene with 500 game objects is like 0.006ms on cpu anyway haha
Game object atm includes renderables
I don’t wanna do an ecs until I finish the uni portion of the project
nice, i haven't done much realtime (by which i mean i basically did learnopengl and that's it lol)
You using Assimp?
nope
Ahh 🙂
I did that shadow filter just from knowing a lil bit about how Pcss works
Ah ok
Gltf is nice
though i'm gonna be working on my custom scene format next because gltf doesn't support everything i want and is actually pretty slow to load
well, not the gltf itself, fastgltf lives up to its name
You can process with fastgltf and save as your own binary format
decoding the png textures for something like intel sponza takes >1m
Ah shit

I need to add texture loading but first I wanna do a material system lmao
(i could multithread it which would make it much faster ofc, but still, i do want my own scene format)
ye, that's the plan, custom format with options to import gltf (which i already have) and possibly usd and other formats
I have to learn cpp decently enough to make some weird social network thingy as final project for the module
Yeah 😄
not so much in cpp, it isn't too bad though
i'll have to build my own nih thread pool/job system at some point
Assimp is cool but I only use it because it gives results and supports everything
Ahhh yeah
yeh, fair enough, i used it once and found it slow and hated its api
but it does support a lot of formats which is nice
heh
and quite shrimple to integrate
you should check out fastgltf tho, it's good
also the author is in this server and a cool frog so you can bother them if you can't find something in the docs lol
ahhh 🙂
not afaik but i think it does have a c api? or it was being worked on, idk
yeah I don't wanna bug people tho cos like I got in trouble for saying about trying to get some code gpt spat out working lol
or just switch to c++ the superior language 
I used gpt to do my pbr but that's all 🙂
cos I don't understand mathematical notation in papers 😄
time to learn them maths
haha well ye c++ is good but meh
I'd rather use rust if I wanted to learn a new language
mmm thread safe by design
borrows et
c
good stuff for if I ever learn vulkan lol
anyway peep this for how I load my assimp stuff 😄
sorry for the big message hang on
oh thanks discord for making it smalleer 😄
the new parent thing may or may not cause issues but probably not as it doesn't matter if it maintains a hierarchy lol
it loads the scene so I don't give a shit until I need to worry about parenting for blender files etc 🙂
oh yea rust is my preference for sure, but if i'm doing graphics stuff i'll reach for c++ just because it's kinda the lingua franca of gp
so much more likely to find the right libraries and resources
yeah
if those are assimp apis they look way nicer than the cpp ones heh
here's light radius turned up far too high
but as you can see no artifacts or issues really as I have per pixel noise (the classic frac(sin shit)
adds a bit of noise but it's ok
I'll try and do materials but I need to shuffle some stuff about
thinking of doing a thickness estimation with shadowmap and projected z to do some sss shit but I need to add some data to the gbuffer aha
gonna try and visualise the depth difference between projection and the shadowmap see if it's feasible to do sss using that
anyway feel free to dm me if you wanna chat 🙂
will try to remember to attempt to compile your pt
😄
at some point
sure, lmk if you have any issues
i’ve only ever used the metal debugger with programs i built outside of xcode (by starting the executable from xcode, not attaching to running process). is it really that much nicer to warrant using xcode as your IDE?? it’s so shit, you can’t even hover over variables to get info
yeah i am seriously considering going back to clion/cmake and using xcode for debuggging
@coral abyss how do you get clion/vscode/whatever to work with metal shaders? i know you can get most of the way there by telling it to pretend it's a cpp file
but iirc you need some additional defines and such
i’m cheating by using wgpu instead of writing metal directly
Yeah btw it’s asahi fedora
Supports gl4.6 and vk1.3
I want to try and do voxel cone tracing on my windows flavour of the renderer hah
@winged veldt why you dont use gulbrandsenFresnelFit()? can you do compare with Schlick approx?
gulbrandsen's approach looks better
is halton give HUGE advantages in quality?
why halton, not hammersley or sobol?
placeholder sampler lol
i'm gonna replace it with a nice fast sobol implementation soon
i just didn't bother yet cause ehh it works
but it's a crap halton stolen from apple's ray tracing example
notice how the scrambling is a texture written with rand() on the cpu side 
i think i intended to then didn't bother
Saint lazyness
The gui looks nice, I gotta add one too.
i like the white theme too
but you can do one better 🙂
these drop down thingies kind of ruin it
however, with this simple trick you can let youtubers know:
style.WindowMenuButtonPosition = ImGuiDir_None;
how to hide it 😉
tbh i only use it because i dislike the default imgui dark theme and didn't bother to make my own yet lol
will be keeping it as an option, though
it does look nice anyway
@jaunty void 
i think ima do dark theme now
working on ui shit for a bit will be a nice break between all the renderer stuff and refactoring the entire data model
i'd like to get icons in as well, afaik the easiest way to do that with imgui is an icon font but i'd rather have my own custom icons and if they can have color even better
please do 🙂
dark theme wip
also trying out a nice green/teal accent color, blue is good but a little too generic
ye, i should figure out how to remove the titlebar and just keep the traffic lights
like imhex
borderless binbow perhaps and then 3 custom buttons ye
they're not custom
those are the native buttons, pretty sure there's a window mode in macos where you can keep the buttons and just remove the titlebar
i see, but it also looks like the menu is drawn into the non client rectarea then
ah that could be a cocoa thing perhaps
afaik it's borderless with the buttons as an overlay
i dont think so
looks like they have custom backends for each platform
source/window/window.cpp
source/window/win_window.cpp
source/window/macos_window.cpp
source/window/linux_window.cpp
source/window/web_window.cpp
macos uses glfw
ah, ima have a look
telling sdl to make the window borderless loses the traffic lights and rounded corners too
sadge
tbh i can probably hack sdl some more
i've already added custom events to it for touchpad zoom lel
wurst case you add some custom title bar which handles mouse capture for moving it around
and the system buttons
ah apparently glfw provides access to the cocoa window object
wonder if sdl exposes that
@jaunty void mission accomplished
now i need to add dark theme to the viewports as well
and a custom light theme
i think i can get fancy and make it use the system theme 
now supports viewport theming, couple more things to tweak but it's looking pretty good
Is sdl needed? W/o cant be?
How are you doing the outline?
There seems to be a weird thing happening where the small dragon pick ups the outline here
Outlines are hard 
i use sdl2, so if they did i could've just yoinked their code
i pretty much still did, just had to find how to get a handle to the cocoa window object from sdl2
that's intentional, actually
what i'm doing is fairly shrimple and works super well
i just write a secondary uint16 framebuffer with the object ids for each mesh
then in a later pass i run a simple edge detect kernel on that fb, color the results (selection color if any of the pixels match the selected object id, gray otherwise) and merge it into the main framebuffer using the edge detect value as the alpha channel
having that framebuffer also lets me select objects by clicking on the viewport without doing a raycast or anything, as i can just read back the pixel behind the mouse cursor to get the object id
btw this is the reason i have uint16 object ids lol
i'll have to upgrade that to u32 eventually, that fb isn't too big anyway
if your peach looks like that don't eat it 
😄
oh looks nice
i'll read the full thing later, might be interesting to implement
it's always heitz isn't it
hehe ye
i wonder if it works well with the blue noise sampler from that other paper
one thing that bothers me is that this is only relevant at low SPP count
I'd expect 64 or more to show barely no difference
and I don't expect my offline renderer to produce anything that useful below 64 SPP (although this may actually be debatable with ReSTIR shenanigans)
If I understood correctly, this paper is completely independent from how you actually generate your random numbers during integration
from that other paper
which one?
yeah seems to be
so i'm wondering if they sort of synergize to give even better blue noise characteristics
oh okay
ah, didn't check results
i'm on phone so i just read the abstract heh
i'll send link when i get to my pc
well the thing is just that with more and more SPPs, the noise disappears so blue noise or not, you can't really tell at some point
ye I guess that's right
"give it a shot" is probably the best answer
it do
still stuck on getting the scene stuff right
and probably end up rewriting it 3 more times anyway 
the custom scene format?
not yet, that's the next bikeshed
this is the internals, all the code for handling the scene graph assets etc
i ended up using entt for the scene graph which is nice since the ecs model makes it super easy to extend with new stuff should i need to
asset manager otoh is a pain
i'm still debating how to handle it exactly
i think i'm just going to keep my own ref count because it's the most strsightforward way to get the features i want, but it also means a lot of interconnected code
bruhhhh engine management stufff
helll nahh I'll keep my disgusting architecture xD
pray in the trustworthy 1-level BVH no instancing no scene graph no nothing 🙏
notes of one implementation
https://gamehacker1999.github.io/posts/bluenoiseerrors/
and one more https://github.com/gao-duan/BlueNoise
alright, after some more thinking about the use case and implementation i think i've arrived at an asset management model that should work pretty well without being too complicated
one thing i noticed is that having ids as handles to resources is far more flexible than pointers, so i'm going to keep that and avoid using shared_ptr for everything even though it would make parts of the code cleaner
also, i need some assets (like individually imported textures, or user created materials) to live on regardless of whether they are in use or not, as it's entirely possible for them not to be in use when created, but i also need a way to quickly clean up imported assets (ie from a gltf) which are potentially very large with 100s of textures, meshes and materials
then there's the issue of manually removing assets which invalidates references to them
considering all that i decided to keep my current implementation of an internal reference count, dropping assets when they are orphaned, and simply add a "retain" flag that can be toggled on and off for individual assets which tells the asset manager not to drop them when the ref count hits zero
imported textures and anything user created will be retained by default, anything from a gltf import will not, so removing it from the scene will drop any assets that haven't been manually retained or used elsewhere
and as for the reference issue, i'm simply going to stop reusing ids (don't think i should ever run out of uint64...) and invalidate references to deleted assets (probably by just removing the key from the assets map but not the refcount one)
i can deal with invalid references later, probably just culling those objects from the scene when rendering and adding a warning to the ui
for reference, iirc Blender for example keeps everything alive until you ask for a cleanup of unused assets
oh wait NVM you're probably going to do that for user assets and immediately clean up unused GLTF assets as you say below
yeah, i can easily implement this for retained assets
and even add an option to retain gltf imports so it behaves like blender
i wanted to have the auto delete for imports though, cause importing and deleting gltf assets is a pretty common use case and it's trivial to implement once the ref count is in place
did you do the ui framework your self or you used a library ?
if this is imGui then i will never have to worry about ui at all...
oh yea people do some impressive stuff with imgui
this is imgui as well
idk at which point you're better off writing your own ui, though
imgui is rather limited when it comes to layout (haven't run into those limitations yet, though)
Did you find what paper that was btw?
oh ye i frogot https://hal.science/hal-02150657/document
Yoooo Lyon university that's me 
So that's basically concurrent work to the other paper no?
One more similar
https://abdallagafar.com/publications/gbn/
Ahmed's Owen is good
Sorry wrong link
I mean this
http://abdallagafar.com/publications/zsampler/
Btw does hw rt work on M1 Pro?
I can’t remember if it does
All I know is I’m enjoying pissing about with rust and (for Mac) metal even tho wgpu abstracts the balls off api specifics heh
Tempted to do bdpt but would need to know specifics so I can adjust to make it the best it can be per platform heh
Everytime I see "hierarchical" I can hear my GPU screaming in the background though
hmmmmm actually they seem to suggest it's fine for GPUs with their hashing approach
nice
That's white noise at the top
and FFT at the bottom
why isn't the FFT white noise too?
Hmmmm I guess it's the emissive quad actually
implemented here https://github.com/MomentsInGraphics/vulkan_renderer
described here https://momentsingraphics.de/ToyRenderer3RenderingBasics.html - search for "Ahmed"
nope
the apis do work iirc, but the gpu doesn't have rt cores
rt hardware is m3 and a(whatever-is-in-the-iphone-15-pro) onwards
oh, if the 'Z sampler' in this paper is the same one described in pbr book 4ed i implemented it in yart, works great
it's hard to make it performant on the gpu though, iirc
i'll have to read the paper to see if they have any notes on a gpu implementation since pbr book doesn't
assets are being managed 
took a while because this is a major rewrite of the entire scene architecture, but the new code is much cleaner and should scale much nicer as i keep adding stuff
being the first major refactor i did it was also a nice test of my overall architecture, i think it went pretty well as even though i completely overhauled the api for one "module" the changes to the other parts (ui, renderers) were limited and quite simple which tells me the "contact surface" between modules is small
Nice one
Looks good, can you path trace in the “editor” viewport or is it limited to that lil output window?
it's on its own window, but it can be resized
at some point i might add a "live" pt view, but it's not a priority at the moment
i think i'm going to make the ui a little nicer and start working on the scene format
big render window
(imgui docking is great)
i have to see if imgui has an api to save/restore dockspace state so i can have workspaces kinda like blender
Doesn't it save stuff to imgui.ini automatically?
Yoooo Blender soon
yeah, i mean in memory within the application
ig if it saves it to the file that must be in memory somewhere as well
Oh I see what you mean
took way longer than it should have, but i added a nice grid display for textures in the asset manager
theres even a demo of it in ze imgui demo -> examples menu
ye, but i'm probably gonna look at the example code and rewrite cause that supports pretty much all the features i was gonna add anyway
and looks cleaner than my cursed table shit
ima keep the layout and texture preview, though
aye
looking nicer now, and it supports showing all asset types at once + multiselect
ima add some filters and a preview/properties panel
also, sdl is pissing me off, the scrolling behavior sucks dogshit
please, how much time did it take you to build this engine +
how many years of graphics programing do you have ?
did you build an engine before it ?
ehh been working on platinum on and off since... november last year iirc? progress has been kinda slow because life keeps getting in the way though
so you have 1 year of experience in gp ?
been doing gp somewhat seriously for just over a year i think, this is my third path tracer in that time
i spent most of last year working on https://discord.com/channels/318590007881236480/1253906693989994549
this is the first one with an actual ui, scene editor etc tho so still pretty new to the whole thing
i did some gp related stuff as far back as high school almost a decade ago now but few and far between (a couple very crappy ray tracers, a software rasterizer and super basic opengl stuff)
most of my programming experience is in webdev actually
don't worry about that tbh, take your time
php? node? or frontend?
frontend, mostly react/nextjs stuff but also some node backend stuff
frfr
if only ray tracing for both fun and money 😭
just wanted to say the intel sponza render looks really nice on the cover photo 
finally everything works with the new rewrite + asset manager
time to work on the actual scene format next
i'm thinking of combining json for the scene hierarchy with a binary dump of mesh/texture data in the same file
splitting into parts should be trivial with a shrimple header
got a quick json export test working, i'll refactor tomorrow to move all the serialization code to a different file/class and complete the scene export with materials etc
then just need to figure out the binary part, i think i'll just add some properties in the json with the byte length + offset of each buffer/texture
then i can have an extremely simple header (just a uint64 with the length of the json in bytes), loader takes the json bytes, parses that, then reads in asset data as needed
i might actually do two formats with one being json+sidecar binary file just for ease of debugging
i really am just reinventing gltf lmao
do you export with printf or some library like simdjson?
why don't you addopt glfw as your engine format then ? (or is it for fun ? )
gltf materials don't support the properties i need, and texture encoding/decoding takes forever with large scenes
intel sponza takes ~30 seconds to load in and most of that is png decoding
granted that is single threaded, i could bring it down to 4-5 seconds by decoding on all threads (and eventually will) but i'd rather not have to deal with texture decoding at all
you can repack textures to ktx for example and cache and in next time when you load scene you can check cache exists and load cached. Load time can be smaller
this algo is implemented here https://github.com/gameknife/gkNextRenderer/blob/a5fe38148e7c7bb4a1cd98814e6b05bc8d1070f2/src/Assets/Texture.cpp#L202-L354
GitHub
A Realtime PathTracer. Contribute to gameknife/gkNextRenderer development by creating an account on GitHub.
you can cache slow pngs only. jpg loads faster
or i can ditch gltf altogether, making a scene format is not hard
no decoding algo will be faster than memcpy
json side of the scene format is done 
now just need to do the binary dump for buffers, textures etc
should be simple enough, just write the data to a file and store the offset/size for each one in a map, then write that to the json
added binary data file, now just need to write the code for loading scenes from these files
it saves pretty quick, but the downside of doing no compression/encoding whatsoever is the files are beeg
intel sponza is 7gb compared to 2.5gb glb
Did you plan to use wuffs for faster images loading or pkd images formats like bc ir astc?
i'm not gonna bother with wuffs, no docs
might look into some trivially decodable format in the future but for now file size is a non issue
ye, i might look into compressed texture formats later
Yeah idk if there’s much benefit for something like a path tracer where you ideally don’t want compression artifacts etc but ye
it's not lossless?
haven't looked into it at all, file size is not a concern atm so i'm just dumping texture data to a file lol
i will eventually multithread gltf loading though and if it's fast enough i might use the same code to encode/decode images for my format
it's flexible enough that adding options should be trivial
scene loading done, i call this a big success 
Loaded scene intelsponza in 3332 ms
Import glTF sponza-new-ivy in 23559 ms
quick profiling tells me the loader is heavily i/o bound, it is reading 7gb of uncompressed texture data after all
ofc gltf import can go much quicker if i do it multithreaded (and eventually will), would probably get down to 5ish seconds on my m3 pro
i'll have to look into possible lossless compression algos for textures that are very quick to encode/decode, or metal's gpu encoding, might actually make the loading quicker as it's i/o bound
anyway, i have a scene format, that's enough for now
time for fun post processing stuff
added live editing for post processing settings, now everything can be changed during/after rendering
also exposed agx "look" parameters, though i want to add additional post processing steps next (including proper color grading)
Pls add davinci resolve style colour grading guff
😅 just modify the colour picker a wee bit eh
Looking very good
never used davinci resolve, what's it do?
it's video editing so probably pretty complex stuff
i'm thinking of doing a lightroom style thing where you can modify curves, but idk yet
why does that look so neat
what part lol
i forgot to clamp the agx saturation slider and you can use it to invert the colors 
made some ui changes to put all the labels on the left, the imgui default of having labels to the right of the controls annoys me
the imgui parts 🙂
: )
basically that, but instead of just curves you have colour wheels for the highlight, midtone and shadows
I guess just generate a gradient from highlight to mid to low and map it using the image luminosity ? 🙂
yeet
though, anything color related in the ui has the ever present imgui skill issue of not being in srgb
imgui is in linear color, doesn't do any srgb correction
yeah
kinda makes sense because of how it's designed but uhh
so I guess uh, custom imgui shader? 😄
with per-widget toggle 😄 😄
good luck with that one 😄
i'll figure something out lol
btw can you upload an executable build so I can try without having to compile it myself? when you get time 😄
I've got an m1 pro 🙂
unless
clion is what you use yeah?
I can try to compile it with that, hopefully it works ha cos otherwise I ain't got a clue how to make it work 😄
will give it a go anyway :)))
ive seen a color wheel thing like those somewhere in the imgur galleries
booo ;-; missing openimageio
;-;
it's homebrew'd but shouldn't it be included in the repo ?
rip
you should try to find some t ime to set up github actions and have it build into a mac app automatically 😄
ye, it's cmake
it's a giant pita to build from source
Aw shi
Can you do a build or help me build it? When you have time- I wanna try it haha
added the flim tonemapper and boy does it expose a lot of parameters
@burnt peak you might be interested in this one, it seems to be a full on film simulation with negative+print much like you've been looking at
oh yeah - is this the one?
https://github.com/bean-mhm/flim
ye, that's it
I watched that guy's youtube video - good stuff
I more or less expanded on what he described.
it's actually very similar to agx
implementation is a fair bit more complex though, agx is very simple
except he uses a simple sigmoid curve
ehh - sure, he goes through the trouble of kind of modeling everything in detail, but the actual curve is simpler, and reused for every channel
unless it's evolved since that video
yea, more complicated model, simpler curve
though i do like that the curve can be adjusted with just two points, though
that must be new
or is it? I think in the video used smoothstep - maybe just as example though
yea it's not smoothstep
uses a sigmoid curve with a linear segment defined by two points
awesome
I'm going to try fitting some LUTs for the second stage of mine and see if that goes anywhere
ye, it's just an example lol
ah - cool
I'm blind
I tried a 7th order polynomial with added crosstalk and it's still not quite enough - so I'll pull all the saturation-related stuff out and leave that for the lookups
I don't know why I'm so stuck on this, but I'd really like to have something flexible enough for specific profiles
@winged veldt what tonemappers you prefer to use?
i'm in the process of trying them out rn lol
i like agx, looks nice for most scenes
flim is neat but it has so many parameters it can be a little overwhelming tbh
i also added the khronos pbr one but i don't really like it, it's fine if you just want a look as close as possible to no tonemapping but it doesn't look very good imo
will try tony and maybe add an aces fit but that's for tomorrow lol it's like 4:30am

What you think about uncharted2? Some times ago I like it a lot
Uncharted2 have lack of contrast but cover more colors
Any guide on that or is it just brew install <pkg>
I think I’ll have a try later on just on my way to uni then got a lecture at 11 I think ?
ok so it seems
the version of openimageio you use is out of date, how can I install the specific version in your project, 3.0.1.0 as I can't seem to figure it out? 😦
@winged veldt
got it mate, figure out how to pull the specific bottle 🙂
ok so you have a nasty dependency on a local file
(:
just replaced your username with mine as I installed the font heh
ok well I got a basic scene rendering that I set up and exported with blender, but the MIS + NEE render mode does not produce anything besides black
😦
Btw mate
Replace /users/leo with $user
Simple brdf sampler works ok with an emissive sphere
Btw, make use of imguizmo save yourself hassle of making your own manipulator 🙂
Overall I love the ui, and found it easy to use after the initial headache and brew being dumb and not allowing you to specify a version like it used to
But yeah keep it up:) will you be adding lights to your editor next? Could add ies profile support as an extra fun thing 🙂
~
oops i forgot to remove that from the very first commit lol
iirc ~ didn't work for some reason? hence the absolute path
but ye, gotta fix that
ye planning to add soon
weird, can you send your gltf?
or scene
that would be a nice thing to add ye, i do plan on adding support for spotlights etc at some point (no point/directional lights though)
you have any good reading on that?
(btw, the reason i don't include the font with the app is because of apple's licensing not allowing redistribution)
It has an area log it on it but other than that no fuckery haha
send ze file
Ah ok and yeah gimme a sec I’ll send it over 🙂 just vaping then I’ll go sit on laptop, also I got 3/3 for the lab I was in, it’s c++ so I felt a bit bewildered haha
emissive surfaces are the only type of light supported, other than hdri
I can understand c++ decently enough
Also it still didn’t work when I added a sphere with emissive
I’m on M1 Pro 8+10
I believe those are the core counts, but yeah I guess something doesn’t like me if it’s not working, but as far as the ies goes, I asked ChatGPT to help me convert the spherical encoding of the ies into 2D cookie 😬
It doesn’t have hw rt but it falls back so idk what’s up unless the scene is just weird breaking it gimme 5 mins I’ll send the glb
yeh, unless there's something in the nee path that's not supported on m1?
but afaik all apple silicon macs have the same feature support
Hmmm yeah I’ll send the file just getting a coffee 🙂
alright, so the machine is overheating so I got water, let me upload the file 🙂
there you go hope that works ok with it being discord :V
it's just a plane and a cube lol with an area light and camera 🙂
btw, just fyi, the only way to rotate camera is using two fingers on the mac trackpad, there's no way to use an external mouse 🙂
but I guess that's just because it's what you use 🙂
I wouldn't have thought there'd be any difference, are you using some sort of mac specific multi touch api? )
also for me at least, selecting in my scene glb - I can select the plane, but clicking the cube does nothing 😄
playing about with it, the selecting seems to completely stop working heh
well the scene has no lights for a start 
blender's area lights are not geometry, so i don't support that
works for me if i add an emissive sphere 🤷♂️
you were setting emissive strength on it to something other than zero, right?
this might be because of how the outlines are rendered, if you don't see the outer edges of the plane both selections look the same, check the scene graph to the left
and ye, no external mouse support cause i don't use one so uhh i don't care 
might add later but it's a very low priority
mice on macos kinda suck ass anyway
nope, even with an emissive sphere it only renders on simple for me
(and yea, i'm using the touch inputs for scrolling, also modified sdl2 to add the apple magnify event for zoom)
😛
yep
oh that's weird
might be a hw support thing but i don't see anything in the support tables to suggest that
I can show you a video 🙂
sure

the fuck
I did the same exact thing as I did before
with the emissive stuff
it was rendering black before and now it works?????
uhhh weird
however
selection is very weird
I'm in fullscreen btw
how so
works fine for me
the way i do outlines might be a little confusing ig
it's not the outliens
I'm constantly clicking in that video
can't select the cube by clicking it
oh that is uhh yeah not supposed to happen lol
😄
wait
did you happen to move the window to an external monitor by any chance
and is that monitor low dpi
oh I have an idea, are you by any chance using your mac in a specific res?
no this is on my native display
cause iirc i don't support display scaling after startup
but it should detect properly on start
nah
that should be fine
...unless i just forgor to scale properly there
oh yep
i just hardcoded a 2 
well ima fix that
yeeeeeet
hahahaha
this is fun 😄
not many people have tested this right? so some things that work for you just by chance don't work for me, we be fixing bugs today 😄
how are the render times on an m1 btw
yeah you're the first
I wanna know why it's not working sometimes with MIS NEE
haha 😄
yeah well I don't mind testing cool shit
and uh I'll make a vid 🙂
just don't expect the bugs to get fixed quick cause i'm working on my postprocessing

lol
ye, the MIS NEE is ropey
this is what happens when using an emissive material on a sphere added from the editor
that's odd, works fine for me
and with the cube emmissive from the gltf file this happens XD
lmao something ain't right 😄
oh wait a sec
what is a sane value to use for emissive strength
because before I had to have it high
oh it was an issue with mat
but yeah your sphere and I guess cube that can be added from add menu
seems to break stuff 😄
and it's working again kek
weird
ignore the white floor
I had emissive on the mat
try pulling the pp branch that's the one i'm working on
but there's deffo a bug where emissive sucks light out of the scne 😄
yeah I will try that 🙂
MIS NEE seems to work ok
let me try do what I did before to replicate the bug
pls, when you get time btw, add support for maximise without fullscreen by double clicking the title bar 😄
uhh don't set it to negative ig lel
I didn't 😄
oh yea
i use rectangle so i forgot about that completely
but ig since i hide the titlebar that's gone
gotta figure out how to bring it back
hm seems to be fine now so I guess it wasn't a bug just my own error 😄
or it's a tricky one, but yeah weird 😄
wontfix: unsupported hardware
(unsupported hardware is anything that's not my own laptop
)
also I like how you've got a lut generator 😄
do let me know if you figure out what might be causing it more specifically though lol, if i can reproduce i'll fix it
and ye, I guess it's fine if you don't care about others using it, it's a personal fun project heh
oh yea, that's internal but i just made it part of the thing cause i already have all these parts might as well reuse them
and yeah I'm not sure, like setting a light to negative just makes the whole scene black in the render view instantly
but in the bugged time, it would take colour away slowly 😄
and that was without negative in the emissive
oh that sounds like nans
not the nans 
😢
oh well i'll have to check it out later lol
yeah it's strange that it randomly happens 😄
tbh i'd like it to be generally usable later, but right now it's super wip so 🤷♂️
yeah hehe
I like it anyway
I've gotta do a similar thing but in rust, just as a way to learn rust and wgsl which is very unique compared to glsl or hlsl
glsl to hlsl and reverse is easy to transition, but going from hlsl / glsl to wgsl is really weird because it's completely unique 😄
my first path tracer was in rust 
it's kinda shit, just following along with rtow but it was super fun
heh
ngl i miss rust lol
😄 rust is pretty nice
I've had tons of people at uni saying oh learn rust
so I started 😄
c++ supremacy
i'm one of those people lol i'm a rust evangelist at uni
(then i write c++ for most of my shit lol)
haha 😄
my uni module leader for adv programming (C++ module) hates rust
but yeah i think i prefer c++ for gp, anything else i like rust better, just very nice to write
though, gib polonius pls
meanwhile, laughs in thread safe, memory safe
tbh c++ is ok it's just hard to figure out having never used it
did you do your rust raytracing on the gpu btw?
wgpu W
I'm legit hopeful about doing the path tracing stuff, and ohhh was it multi threaded ? and ah yeah. Ithink you did say that in this thread somewhere woops
😄
we had Rust in our operating systems and security class
but only as a discussion topic on how to easily eliminate memory safety issues
heh, we've got it next year in some multithreading module along with C++ and cuda
heh
also
linux on mac runs on rust
(asahi)
ye, well parts of it
i think its only some drivers
well I had my first CS exam today about basic C programming, arrays, lists, queues and such stuff so that is still far away for me
bro showing up at uni with a smurf account
kinda
on a totally unrelated note, @quick zealot i was thinking last night and i think i came up with a way to do gmon with slightly less insane memory usage
still needs one framebuffer per bucket, but at least it's not two per bucket
but basically instead of each bucket getting two pingpong buffers, each bucket gets one accumulator buffer and you have one single buffer you bounce off
anyway ima try to implement it soon™ when i finish setting up my post processing pipeloin
Cool idea 😅
@winged veldt ???
gotta add it to the tonemapper list
added a proper post processing pipeline with arbitrary number of passes (tonemapping pass is always on and at the end), rn i only have the exposure pass so i did this thing to test
Me too to my renderer
but it should be pretty shrimple to add more post processing passes now
And autoexpo
actually exr output is pretty trivial
Yeah haha
i just export the pre tonemap framebuffer
Yeah heh
Yeah I mean Macs are all hdr hehe
M series anyway idk about air models but I’m guessing those too
HDR on Mac is amazing tbh
ye, works great
i have to figure out how to actually use it, though
and more importantly deal with imgui
that's probably gonna be the hard part
I do. with and w/o tonemapping
why two per bucket? I've been using one since the beginning 🤔
Why ping ponging ?
What I do is I have one framebuffer per bucket yeah
So 5 framebuffers if 5 buckets
And
sample 1 is accumulated in buffer 1
sample 2 is accumulated in buffer 2
...
sample 6 is accumulated in buffer 1
ah wait you read and write to the same buffer?
Yeah, I only need to read when I do compute the GMoN stuff
otherwise, it's just accumulation
(every M samples i.e. when each bucket gets 1 sample)
accumulation is r+w tho innit
huh
so yeah I read/write to the same buffer indeed
am i stupid actually
huh iirc the apple rt example used two accumulation buffers
wonder if there's some berf reason
ima try this when i get back home
why two?
like read from the first
sum to the value read
write the summed value to the second?
ye


maybe the rt sample is just poop 
ig i just assumed the apple example did it for a good reason lol
and then just left it there
maybe
or simplistic for "sample purposes"
apple skill issue
it's literally easier to writr to the same buffer tho
true
oh wait
i think i know why
compute+raster parallel
so while you're accumulating on buffer a buffer b is being drawn to the screen
or sth like that
oh I see that would make sense
but huh
that doesn't prevent race conditions though does it? if displaying and rendering are truly asynchronous, this doesn't prevent from the compute writing to the buffer being displayed
you'd still need some barrier somewhere
and if you have a barrier, things are not asynchronous anymore and so you don't need the two buffers anymore?
are they buffers or textures?
textures
textures can be read+write?
turns out they can
so uh
there's no reason to bounce two framebuffers for rt
basically i am stupid
a little bit of color grading can go a long way, this is just simple lift/gamma/gain after tonemapping
got the shadow/highlight "zone" exposure working a bit better, it's actually pretty usable now, also added vignetting
also wow that's a lot of fireflies, i should deal with that lol
@quick zealot how are you sorting your buckets for gmon?
i assume you're doing it on the gpu in a compute shader
fireflies are being dealt with
unfortunately gmon also seems to get rid of a lot of indirect light along with the fireflies
i'm gonna try tweaking some parameters to see if i can improve it, but i might go looking for alternative means to remove fireflies because the donwsides are pretty big
i had a bug, looks much better now though it still has some issues
fixed, turns out 11 buckets is just way too low to get good image quality out of it
ofc more buckets -> better quality, though oddly enough at 25 buckets the best results seem to be when clamping the gini function result to 0.25 so it's not overly aggressive
15 seems to be the sweet spot for image quality vs memory use (which is significant, given every bucket is an additional framebuffer)
some nice renders
anyway now the fireflies are taken care of, i think i'm gonna do a quick round of refactors/cleaning up the code and then finally work on replacing the placeholder sampler with something better
honestly it's plenty fast
cause i do have a 3060 ti which would probably be more performant, so thinking wether to use vk or mtl
those two renders are massively oversampled, 4k and 1k samples for the left/right one
left took ~6 min, right about 2 min both at 1920x1280
ah ok so its just more orless bruteforce right now?
mis+nee, usually i'd be rendering at 200-500 samples but these have a lot of indirect lighting, really these are scenes i should be using bdpt or similar on
and i haven't done much to optimize perf
for example it's all one megakernel, idk how much faster it would be if i was doing wavefront (i intend to switch at some point)
tbf I could probably slap a raytracer ontop of my previous attempts at a gltf renderer, since that's written in a really modular and nice way tbh
3060ti is probably gonna be faster, but the m3 pro has the vram advantage because all your ram can be used as vram, so there's that
well yeah it's a lot simpler
I mean with my renderer setup I could also have it run on both apis at the same time, with a dedicated renderer for each but with shared shaders
see whats quicker
though yes hdr + p3 might be a big plus
idk time to think about this stuff after I write this exam which I am totally not procrastinating learning for right now
can you do shared shaders between metal and vk with rt apis?
idk tbh, probably not since spirv-cross doesn't support it
what I do is I abuse macros to their fullest extent to have a single header compile as GLSL but also as Metal
and then I'd put stuff like the BRDF or other functions like that into those headers
and then the Metal or VK specific shaders just call the functions from those headers
well in theory at least, in my project I only focused on the Metal impl so most of the stuff is metal specific code, still
definitlely not easy to read, I'll be honest
but that's one of the worse examples
yeah it's on the GPU, each thread sorts its M means with a single threaded radix sort
Can you send the scene for this one? I think I'm seeing a different behavior when cranking the number of sets up
I've found that with more sets, my denoising/darkening/bias is stronger and more samples are needed to get an acceptable bias level
but your images here show the opposite? (if they are equal sample count)
oh
yea, these are all 1024spp
i expect fewer buckets will work better with fewer samples
but gmon really does not like sample counts under 100 or so
Even on my non-hw accel M1 Pro it’s fucking fast 🥰🥰
oh neat, i don't think i asked what kinda render times you're seeing
@quick zealot here's the scene btw
should be the same as the one i'm using, don't think i modified this one in editor
You did I just forgot to say
Btw how are you able to do sun lighting. I didn’t see an option I don’t think in the editor 🙂
it's just the hdri
@quick zealot you have gltfs for the white room scene and the other similar ones?
i've only found blender files but the exporter shits itself
got distracted with this, found a nice model of the main hall of the london natural history museum, had to do quite a bit of cleaning it up in blender but it looks pretty nice just lit by sunlight
no textures unfortunately, i might have a go at adding them later at some point
what did you have to clean up?
(i also removed the glass for this render, i don't have transparent shadows or anything so nee wouldn't work with it)
the original model is only half, so i had to duplicate and flip it, also cleaned up a lot of poorly placed sharp edges that made the columns look not-round
then i merged the whole thing because blender can't export a gltf with transforms if its life depended on it and had to spend a while fixing flipped normals from the parts that were flipped with a negative scale
cleaned up nicely though, and the model is great—actually made by hand with good (if a little low poly) topology, most of the architectural stuff you find on sketchfab is 3d scans which are kinda useless for rendering
and the detail is fine if you don't look too close
at least all those scans of the place will come in super handy if i decide to texture the thing
ah
I have to fix models inside blender too, like add tangents or fix the textures. Was wondering what this involved for you. Thank you
i add the tangents in engine (mikktspace) specifically because blender doesn't export them properly half the time lmao
i will never get tired of shitting on the gltf exporter
I'm going to try and add an fbx importer to my engine
I haven't added mikktspace as I'm just not enabled for any kind of mesh optimization at the moment, I honestly don't even know how, like how to fix all the index counts and starts on all the primitives after mesh optimization
i'm not actually using it properly atm but i choose to ignore that for the time being 
about fbx uh, good luck
Which fbx lib you plan to ise?
So in order: OFF, 5, 7, 11, 15, 17, 25
1024SPP
Actually on this scene there is basically no difference because the variance isn't too bad
Your indirect being quite a bit darker is a bit sus I would say on the front face of the dragon
There are no fireflies there so why is GMoN murdering that spot?
There is a bit of darkening between OFF and 25 which I guess is what I wanted to see initially
seems https://github.com/nem0/OpenFBX is good and popular
GitHub
Lightweight open source FBX importer. Contribute to nem0/OpenFBX development by creating an account on GitHub.
and maybe https://github.com/ufbx/ufbx not bad
about fbx libs need to be tested both approaches
But it's way more pronounced on Sponza where the variance is worse:
OFF, 5, 7, 11, 15, 25
512 SPP
Ok let me cook
Thank you will take a look
Those are pretty much all the good scenes I have right now: https://mega.nz/file/s4BCARRZ#P_mEpVjimxLYojhc6aiZbEsCzcT2MPxguXg8cI5m0bw
3 the white room versions:
lucyis the one I used for the screenshot above (although the material was edited at runtime)lightsis the one with many lights for stress-testing NEElowis the one with more lights thanlights(naming doesn't really make sense here hehe)- the-white-room with no suffix is the "easy" one, classic
by "clamping to 0.25" you mean their "Binary GMoN" approach?
my tune ups of lucy material
btw this is a video showing the bug on my mac, NEE + MIS sometimes works, or it does this
that's with the entire scene material emissive
and then
with simple
so I think there's deffo a bug to fix 😄
hm, your gmon off image looks way better than mine, though
maybe it's my crap sampler? i'm working on replacing it so we'll find out soon ig
or maybe it's time to refactor my bsdf code again 
that looks pretty much like what i'd expect, only i'm getting better results with higher bucket counts but that's likely because i'm rendering at higher sample count
also that looks super clean for 512spp tbh
thanks, btw where'd you get the scene? did you manually export from blender?
the white room?
ye
hmmm well I'm still on pure pseudo random uncorellated white noise shit sooo 
oh btw my specular highlights on the dragons scene aren't nearly bright enough so yea, bsdf rewrite time
damn
I think I got it on blendswap
But I did tweak it a bit here and there iirc
how's it look so clean? is that just plain mis+nee?
ah ye
i got it from blendswap but i'd have to redo all the materials
oh maybe I did do that yeah, don't remember 
but yeah the GLTF exporter is poo poo garbage, it basically only exports the principled BSDF 
This mayyy be because my GLTF is ASSIMP
And ASSIMP is ass at reading GLTF
So I strongly assume that it's not reading the specular correctly (may be wrong though but eh, I've seen that before with ASSIMP)
eh? there's no specular, only a roughness param
That's RIS actually
1 BSDF sample + 4 light samples resampling
Wait I'm bsing then xD
Let me check
honestly i think that's fine lol
i'm trying to figure out wtf the code from a paper (z sampler) is doing and not having a good time of it
ngl, i fucking hate pbrt
the code is so ass
book is fine, though
One thing that kind of worries me with LDS is that you have to be careful to not break the stratification so you have to count your samples and rescale them sometimes blah blah blah
Whereas with my good old Xorshift32, you just ask for a float [0, 1] and tadaaaaa
yeah it's definitely more complicated
but it does look much better at low sample counts, so worth it
it's also just really interesting, mathematically
ye I agree, maybe I'll have a go at some sobol stuff someday
it's still good, being that it is basically multiplicative variance reduction with all the rest
yea, it does converge faster
rn i have a crappy halton sampler which is fine for convergence but just really crap code lol
so i want to solve sampling for good
then i can uh
go back to fixing my layered bsdf
Those are the mats loaded
look okay
what's roughness 0 if it's not smooth specular though ? 🤔
ye, that's basically what it should look like
then it's all okay I guess, disregard the ASSIMP rant hehe
yea i mean there's no "specular" parameter as you'd have in some non-pbr material
well technically gltf does have specular intensity/tint but i ignore it
oh ye okay
although wait, I don't do RIS on the envmap, only on the emissives
and sponza is envmap only
so yeah it's pure MIS
maybe that's because I have the full BSDF evaluation instead of just the sampled lobe
might be
but also yeah taking a closer look the noise seems about right
also those trees might be scattering some light into the hallways to the side?
doesn't look like it
maybe pcg4d is better?
what is it?
pcg4d is lds
implemented here
https://www.shadertoy.com/view/XlGcRh
here is interesting approach with blue noise https://www.shadertoy.com/view/wltcRS
is it LDS though?
looks like it's just uncorrelated white noise no?
same as my xorshift
PCG, A Better Random Number Generator
PCG is a family of simple fast space-efficient statistically good algorithms for random number generation. Unlike many general-purpose RNGs, they are also hard to predict.
🤔
i thought pcg was white noise?
afaik it's just a regular prng with a uniform distribution
yes
so not a lds then
pcg4d is better than xorshift
this seems incredibly simple, does it work for higher dimensions?
@winged veldt please read pdf. lds is better
yes. I mean rng
no mention of low discrepancy sequences there
yeah, pcg is state of the art prng afaik
at least for fast ones
xorshift is worse vs pcg4d