#Vulkan Forest Scene
1555 messages ยท Page 2 of 2 (latest)
im definitely doing opengl next
Hehe
lmao
they waterboarded my cohort with mandatory vulkan in sophmore year in undergrad
urm... dunno why i got to take it before I completed OS class ๐
I know too much about the API but not enough about techniques
Literally me

Idk shit about techniques I just invent everything as I go
I feel like this is a good rule of thumb in general because u can bruteforce and tryhard above ur skill level and still kinda develop but then u get strange gaps in ur foundation u gotta go back n fix anyways and its more stress for less gain
too many probably
It's like urm, lifting and stuff
You could probably egolift with bad form if u really force urself
but u risk just hurting urself even if that gives u gains in the short term
Actually how the hell do you know if you're in that zone
wu wei or some shit
I think its easier to tell when u aren't but idk any coding analogy for it off top of my head
but it'd be like trying to learn how to read a new language by bruteforcing a dictionary and subtitling a full movie in it straight away like u would be spending 150% of ur effort for like 5% progress
or like trying to grind intergration before differentiation or somethin
the easiest analogy is probably seen in fitness but i think the same stuff applies to the brain too, although this i dont have any citations for it
If you only need gentle guidance from articles and can play the rest by ear
Where if u try and force urself to do certain exercises or lift certain amounts before ur body physically cant over n over u just arent getting as much gains ig
If you're copying anything verbatim you're not there
What if I'm copying maths
oh hell yea I am in that zone rn
Because I'm sure as hell not going to reinvent the wheel in maths 
If your goal isn't to learn the math then copying the math is ok I guess, it depends on what your goals are
its actually kinda nice to know that u encourage it. I kinda always took if I have to 'try too hard' beyond that level of being able to understand from an article or description and do the rest myself that I don't have the pre-req foundation yet but i didn't know if that was wisdom or laziness
My goal is to learn, understand and apply it
but the formulas themselves I don't really need to reinvent
I guess it depends on what we're talking about
Are you talking about like light transport stuff
Fourier, "higher" analysis (change of variables theorem, multidimensional integrals etc.) and some formulas that just "exist"
Like idk, I'm taking a "top down" approach where I see the stuff that I need for my ocean sim and then break that stuff down part for part until I reach the stuff I understand
i can relate to top down approach vibe
wait no i think im bottom up? but i relate to 'i only touch the stuff i understand'
It all depends on your goals, if your goal is to be able to invent stuff like the Fourier ocean then you'd probably need to study those directly out of a book since wielding those tools creatively takes a lot deeper knowledge, but if you just want to be capable of implementing effects like the ocean then it's fine to just learn only what you need
I'm spoiled because I studied physics so pretty much everything in graphics is right in my wheelhouse and I can understand it from first principles just by skimming for concepts
Learning that shit on your own is hard man
I kinda want to learn that shit to understand it enough so I'm able to invent stuff as well
but I learn best when I also have some practical application
Yeah definitely
Are you in school?
University
What year
~2 semesters (including this) until I write my thesis
I take it you didn't have a multivar/vector calculus course then?
I can technically take one but only get access to the lecture afaik
Did you take linear algebra
Did you take differential equations
linear algebra, abstract algebra, some DEs, some calc
ah wait
some vector calc
but not indepth
we did jacobian etc.
but that's about it
SWE, which at my uni means 90% CS 
Yea
holy shit my CS feels like 90% SWE
Wait you did Jacobian but not even multivariable integrals?
Mine was 90% computer engineering which is the best way
we did partial derivatives
Hmm ok
mayb intellectually but for early career I am seeing the benefits of that 90% SWE approach in how my clasmates and stuff are gettin internships left n right
alright time to sleep
have a good one u folks
you too
also @solid jackal is in high school? proud of him fr fr
i learned to code like when i was old enough to drink ๐
but yes
(drinking age in Singapore is 18 tho)
three semesters of theoretical cs, part of which is abstract algebra

it's also where most students that do drop out or fail reach that point 
thank you ๐
sunk cost fallacy best fallacy tbh
and nah im only 16 so i still couldnโt drink
I can only laugh in German here
well we're allowed only the light stuff at 16 but still 
Nah, it is pretty good if you want to clean electronics 
I literally cleaned off the thermal paste with vodka once lol
Didn't have anything else at hand at the time 
oh lmao
i wonder if that other type of alchohol works
hydrogen somethingide
the stuff in the brown bottle
That's not alcohol
Haha
Ok I had to look that up actually because I was pretty sure but then I had a crisis of faith when I realized that there is definitely an -OH group in hydrogen peroxide lol
But it has to be bound to a carbon atom to be considered an alcohol
16yo aren't you taking chemistry this year in school
this next year i think
i wouldnโt expect to learn much though
i happen to attend a school not well known for being good at anything
Ah lol
I changed my grass texture, added some simple lighting, and got a better sky color
this looks like something from windows 95 lol
needs shadows lol
Debatable
My games don't have shadows and they look good enough
I'll probably add them at some point but I haven't really cared thus far
skipping shadows is a good way to have ez perf ๐
i messed up
matrix multiplication confuses me so I just change it around until it works ๐คฃ
Lmao
shadows are overrated. bad shadows are distracting, good shadows are hard to implement.
project some shadow disks under the trees and call it a day
Isn't that just a flag you set
MSAA + transparent leaves = sadness (moreso the leaves aren't affected by it)
Yea rip
Not an easy problem to solve
I'm trying to remember how I do it
I think I just don't lol
Or maybe I use purely geometric foliage
the leaves should already be filtered from the texture sampler to some extent... but this texture isn't doing any favors
I wonder if there's something wrong with the shader. my pixels are huge but come out smooth.
Idk what I'm looking at
oh a zoomed in grate texture
I'm using a linear point sampler shader intended for pixel art
The point I'm making is that that level of graphics is good enough for most development purposes
Idk it's sort of up to you, you need to find something motivating
What kind of games do you play
nah I mean what next for this project
UI maybe?
and I definitely want to do blending
Yeah that's what I'm talking about too
What kind of games do you play
idk
I really like cave story but that's pretty primitive in terms of graphics
some FPS games
Graphics should serve a purpose
Make a 3D cave story scene or something like that
Imo just making pretty pictures for the sake of making pretty pictures is slightly pointless, that's what raytracing is for
Vulkan and GL are for making interactive graphics
Why not
All my games have tons of hardcoding
Maybe not positions of things
But graphics are 100% hardcoded
Generalization in game graphics is generally useless
Unless you have a team of renderer devs to make an in house engine or something your graphics will be relatively hardcoded
Hard coding is how Vulkan is designed to be used, even if that hard coding is organized in config files or something
hm
If you don't want to tailor your graphics very closely to your application there isn't much reason to use it over GL or something
Hardcoding is great for hobby projects but it's not how it was designed to be used
It depends on what you're talking about
Keep hardcoding stuff until it works is good tbh
Pipeline permutations are basically intended to be hardcoded or otherwise specified explicitly
Not doing that is why you have shitty modern engines that have to compile millions of pipelines for no reason
You can do specialization constants and uniform branching for that
Ye true
In 2018, I wrote an article โWriting an efficient Vulkan rendererโ for GPU Zen 2 book, which was published in 2019. In this article I tried to aggregate as much information about Vulkan performance as I could - instead of trying to focus on one particular aspect or application, this is trying to cover a wide range of topics, give readers an unde...
Ctrl f for ahead of time compilation
Huh I somehow missed this blogpost from Arseny
Personally I think that the perfect solution is to have ridiculously large pipelines
Instead of many pipelines compiled ahead of time
There are many different solutions for sure
The point of Vulkan is to let you tailor everything to the application and hardware
Yeah each solution has pros and cons
Unreal Engine games like Hogwarts Row be like
hard coding isn't very real imo
code is meant to solve problems, just a question of if it solves your problem
e.g. you could say an engine with an ubershader has a hardcoded pipeline, but it's not very meaningful
but eh, it's not actually that meaningful of a distinction
cause the point of moving away from specifying heights on a set grid is probably a valuable one
When I say hard coding I'm talking about stuff like having your renderer have an explicit step for drawing terrain or other things that intrinsically tie your renderer to the application
Rather than presenting a generic but more complicated interface that the game then uses as an intermediate implementation layer between the game and renderer
i'm sort of just agreeing with this
LVSTRI โ Today at 5:16 PM
Keep hardcoding stuff until it works is good tbh
Ah yeah I see
That's basically what I do, I hard code and then start exposing control when it becomes necessary
I don't agree with it either generally, but in specific cases it's a good way of getting started, offloading the headaches of API plumbing and whatnot for later
For example, if you are a beginner and you are learning your way through the API
I completely misread your statement didn't I
lmfao
My bad 
:^)
i would bump this though and add some other stuff that might be fun
- add a player camera controller
- skyboxes
- terrain materials
if you did want to lean into terrain, you do have a whole bunch of people you can bug about it ๐
imgui seems more trouble than its worth for this project since i dont really need it and i need to write a custom backend for it
there is a camera, not sure what you mean
first person, walking on the terrain
because then i have to do physics
i mean i first envisioned this project as a photo realistic forest scene but since thats not a great idea
i guess i just want to try a ton of new things and experiment with what i have
you do not have to do physics
but ๐ just ideas, pick what you like or ignore em all, no need to justify
skyboxes help the vibe so much
skybox /atmosphere for sure
perhaps
or terrain multitexturing
billboard what though. unless you make really distant trees
grass ๐
oh, yeah. grass can be a beast
or a cool dinosaur idk
yo doom/daggerfall style sprite billboard dinosaur would add so much character lol
yeah to my windows xp forrest
is it official then?
am i going for the windows desktop aesthetic lol
wait
my brother in Christ this is my project
and I say yes
Imgui is super easy to implement all things considered
It's just that Vulkan is hard in general
In GL it takes like 5 min to get it up and running
yeah
it would be pretty easy on vulkan but the backend doesn't support a vulkan feature that I'm using
Oh yeah baby
multisampling
(top image)
look at the little flowers!
tre
blending moment
i think im multiplying my alpha when applying lighting
yeah its fixed
my leaves look a lot better now
oh they're certainly less distracting now
lol my girlfriend said this looks like the golf from wii sports
As is standard in vulkan, the next thing I want to add will take some time
remain patient
What is the next thing that you want to add
shadows
im gonna need a new pipeline which is always fun
and ill need to work with multiple render passes which Iโve never done before
adding a pipeline shouldn't be that bad
just should work a bit on getting a bit of structure in the project
otherwise it might take longer than it should
Wasn't thinking in terms of abstracting pipelines but rather something that lets you structure the renderer as a whole easier
so you can focus on the important stuff
yeah
is this where rendergraphs come in?
they sound really complicated and confusing lol
no need to do an entire rendergraph
For example I do something like a "flattened" rendergraph which I can later expand into one if I feel the need to
but to actually make use of a rendergraph you need enough "nodes" for it in the first place
Pipeline creation is exactly the kind of thing you should be abstracting
Generally for something like Vulkan you want to follow a semantic compression technique
I have a PipelineCreateInfo struct that I defined that contains all the things I actually care to change in a pipeline, like the render pass, primitive topology, depth/stencil settings, shader info, etc., which just gets passed to a function that handles the rest
Anything I don't care to expose gets hard-coded in that function
well yes but that falls into the "helper" category more for me than abstraction?
Yeah I agree
I think abstraction is the wrong word to use here
What I'm against is generalization
Generic abstraction is usually a waste of time
Specialized abstraction/semantic compression/"helper functions" are critically useful
what is the difference between specialized and generic abstraction here
Yeah im with demongod on this one
Generic abstraction is like writing an abstraction layer that attempts to simplify the use of Vulkan without sacrificing generality, i.e. you could use it to build any Vulkan application
I don't think there's any need in making some advanced pipeline class if im only having like 6
I mean when I say "don't abstract pipelines" I don't mean don't do helpers for it ๐
Specialized abstraction is like "rather than copying and pasting my hard-coded pipeline creation, I'm going to dump it into a convenient function"
Generic abstraction is like trying to roll your own OpenGL using Vulkan
Specialized abstraction is like writing a game directly in Vulkan but hiding the implementation details behind an API firewall that keeps the mess out of your game code
that's exactly what I've been doing lol
main looks like this
I should probably keep my engine state in a struct next time ๐
So I suppose you would also count my D3D12 abstraction more as a specialized abstraction? It's essentially just a list of virtual calls to "execute()" functions so I can write multiple demos using the same architecture without having to rewrite loading and buffer updating etc.
In some sense yeah
I'd have to see it I guess
Generic abstraction usually looks like an API that you would provide in a library, a sign that you're doing that is if you find yourself doing 2x the work
E.g. if you do a bunch of work to wrap your Vulkan graphics in a convenient API, and then you use that API to write a renderer, you're basically writing twice
Whereas if you just write the renderer directly in raw Vulkan + some helper functions you're not wasting any of that time
The only thing I've wrapped was the command buffer and that's purely out of convenience (so I don't have to dance around levels of indirection with my resources anymore)
other than that it's practically pure d3d12
yeah sounds good to me then
I mean ultimately all that matters is whether it serves your purposes well and is efficient to use
Yeah efficiency of use is what I care most about
and as time and need comes I enhance the API for more functionality, say something like "instead of just a list on a single queue I could allow for async compute processes"
The problem with generic abstraction is that you end up fighting your own abstractions, like "hmm I designed my API around this assumption but now I need control over this hidden thing and it's becoming a pain in the ass," whereas with helper functions you're just like "ok I'll just expose this hard-coded thing as a parameter and the 'user' [me] will just set it manually"
I do expose the raw D3D12 stuff if I need to which helps that but I've noticed as well in one scenario where it did bite me
Well it only works if you can pull your graphics code into a black box
What I do is write my game to have essentially no conception of graphics except for physically-relevant data (e.g. meshes, needed for physics/raycasting), and everything else is just an ID
The renderer is content-aware (i.e. it's written bespoke for this game) and just handles raw Vulkan/GL + helper functions
That way none of the impl details leak out into the game, the renderer becomes part of the game itself (but stays isolated)
The difference is that if you wrote a generic graphics abstraction you might be able to replace the graphics API (e.g. swap GL for Vulkan) without touching the game renderer
Whereas in my case you have to rewrite the whole renderer
But it's a lot cleaner and doesn't restrict the API usage at all
a generic graphics abstraction designed around GL is basically just going to be like using GL if you rewrite the backend in Vulkan
Whereas in my case I can rewrite the whole renderer directly in Vulkan and it doesn't cause any architectural pain because the renderer is a black box
I've done this before btw I completely swapped the renderer and only touched 2 lines of code anywhere else in the codebase
And the whole time I have unrestricted access to the API like it's a greenfield project, not fighting any stale abstraction
This is pretty much what I am trying to achieve with this "virtual execute() calls" - Having a renderer per-game and not one fixed for the engine. You decide what you need and extend if necessary.
What I did not want to do is having to redo allocators, binding models, resource management (to some degree), device/context creation etc. manually on a per "project" basis.
Yeah hope I achieve the same there
i think i might get shadows in by tonight
i may have overestimated how hard it would be
Remember that y is flipped
Ah the path of tediousness
I can either add another descriptor to my global descriptor set or just push constants, but that would require a new pipe layout for the shadow pass
either way im tired
im gonna go play minecraft
Descriptor Sets are very annoying indeed
They're something you abstract very early or just use push descriptors
Just use Bindless (tm) 
BDA will save you from descriptor sets 
I didn't find them that bad for my simple purposes, you just have to group by update frequency
Who needs pipeline layouts when all you have is a single pipe layout 
It isn't that bad once you got the boilerplate for them yeah
but first you need to write the boilerplate for them
The only descriptor sets I have are for storage images, samplers and textures
Because there's no IDA (Image Device Address)
I don't have any descriptor set 
OpenGL has Image Device Address btw, clear win for OpenGL
But I also don't have BDA 
my push constants are already bursting with data
im budgeting hard
the shadow pass will need 2 mat4s, while the render pass will need a mat4 and the texture index
and imo descriptor sets aren't the most annoying thing in vulkan
I recommend push descriptors if you don't want to deal with the tediousness of descriptor sets/pools
They're suboptimal, but extremely unlikely to make a difference in performance
In exchange you gain ease of use
How are shadows going @solid jackal
im still figuring out how to get my matrices to work lol
when i get back to my pc ill show yall the problem
im going to do something very lazy
What's that
im putting the sampler to my shadow map at the very end of my texture array lol
Did you manage to fix the proj
yeah I think so
Let's see the shadow map
you're supposed to darken the areas in shadows
reaaaalllllyyyy?
Yeah I know that's astonishing right?
i'm not gonna read all of #questions , is your sun's depth buffer reasonable?
nvm i see you got it
Vulkan Forest Scene
Scope adjustment?
Seems like it
Lol just teasing
Do whatever makes sense
You're finally discovering what the real graphics programming is like
Nice
i think i want a skybox next
i dont think vulkan has cubemap functionality though
so iโll need my own
currently im cleaning and refactoring some code
more specifically im putting most of my data in a big struct so i can spread flow out over functions more evenly
Yes it does
Alright, it's pushed
Cubemaps are just a sampler type
I'm gonna be on vacation all of next week
did you book your time off
Yes please submit your request so we can approve it
no
iโm back
Welcome back
im gone
ready to see more ๐ฒ ๐ฒ๐ฒ๐ฒ
yeah
i completely forgot what i planned next
cubemaps?
i wish i could work more on this than i can
i cant find any good skyboxes
oh well
I kinda wanna make a huge forest scene in blender but due to .obj it will probably take several gigs to load lol
In a game you wouldn't have a unique model for the trees anyway, you'd have 5-10 tree models that you'd instance
Maybe with some procedural scaling or coloration applied
yeah but idk if obj has instancing
what? obj is a mesh transmission format
It has nothing to do with instancing
Instancing is what you develop in your engine
You need to develop your own asset pipeline around whatever you want to do in your application
I meant like
duplicate meshes
I think in obj if you wanted an identical mesh in different locations you would just have to duplicate the all of the vertices and indices
ye
Different locations? Export each tree as its own obj file
And then instance them in your application
with obj you make your own scene representation yes
you have one obj per unique mesh
and instance them yourself
my normals are screwed up
i suspect its because they arent being rotated along with the model matrix
you need to apply a TBN matrix
also you need to decide to either transform obj to world or light to obj space. iirc obj to world can cause precision problems but it works for me
whats a tbn matrix?
I think
I want to finish this simple lighting, add rain, and ship it
tangent bitangent normal matrix
does glm have a function for this?
no look it up. it's a standard equation for applying normal mapping to geometry
ah I see
would this be done in the vertex shader?
ah
praise learnopengl
but I need 2 more vec3s per vertex ๐ฆ
You don't need a TBN matrix if you're not doing normal mapping
Just rotate the normals by the model matrix
Idk your transformation chain you kinda have to debug it yourself
is there any special way I should be doing this?
because rn I'm just multiplying it like its a position vector
It's not a position though it's a vector
it's just normalize(inverse(transpose(mat3(transform))) * normal);
Multiply it like (v, 0)
this is still genning the same results
now this matrix does have translations but shouldn't that not matter since we're ommitting the fourth row and column?
I meant you do it lol
well yeah im just tossing these here
It's not really possible to debug someone else's numbers unfortunately
but these don't seem normalized at a glance
and I think that may make sense since these are tree normals
and the trees in the scene are noticable darker than the ground
Yes those are not normalized lol
then we have a problem
could this be because the matrix also has scale too?
ok its fixed
sunset ๐
I need to fix shadows
I think i might be done with this project
Today i might clean up the code, and push it to the github
ill see if my models can fit on github too so yall can run it
do you feel like you learned a lot?
You could definitely come back to this when you gather the motivation, here's a few things you can add that are not trivial:
- Infinite world with world partitioning
- LODs
I can fit in the .blend file though LMAO
ill just include instructions on setting it up
Alright guys
all yours if you wish to try it
A massive forest scene rendered in Vulkan. Contribute to GrumStomper29/Vulkan-Forest-Scene development by creating an account on GitHub.
What's next?
I'm making a gltf renderer in opengl just so I can learn how the both work
I would just do the bare minimum gltf for now don't worry too much about the PBR stuff
OpenGL is great
Even after learning Vulkan I've never really found a reason to justify using it
I just use the lessons it taught me to build more well organized renderers that could be swapped for a Vulkan impl later if necessary
GL is everything I've ever needed for my projects
yeah lol
im struggling to load a simple model
Use a simpler model
You need something where you can inspect all the data in the file numerically
I've never used gltf so I can't really help beyond that
rt/mesh shaders/some more advanced indirect stuff (ogl spv extension bas some bugs so subgroup stuff may or may not work), close to fully bindless
explicit async compute / copy as well
if performance is no issue and none of those things here are desired or required then yes, no real need to switch
Yeah RT and mesh shaders would be some, I haven't needed them though
And if I did want to use RT for something I'd rather do it in software so that the performance isn't tied to having a certain kind of specialized GPU
I mean
hmm
should I close this?
since I guess im complete?
i might come back to it later but idk
You can just leave it as is and come back to it later, you don't have to close the thread unless you want