October 9th, 2020 Livestream Dylan Talk: Instanced Splines (Part 3)

October 9th, 2020 Livestream

Dylan Talk: Instanced Splines (Part 3)

https://youtu.be/cZgVZMk4zvM

This video is part of a series of 14 videos.
Suggested Wiki Reference Code <ref name="yt-cZgVZMk4zvM">[https://youtu.be/cZgVZMk4zvM YouTube - October 9th, 2020 Livestream - Dylan Talk: Instanced Splines (Part 3)]</ref>

Topics

Transcript

yeah so I wanted to show one other thing here that's of great importance is the ush file which is funny swedish that'd be the clothing of like gross, so this is the shader header which is going to lay out our vertex factory which is essentially telling the gpu what and where in all the vertex properties we need to actually render the mesh and this is another file that has is heavily modified to support our code, the local vertex factory this is, the primary one used for most mesh types but there's these custom macros and the syntax highlighting here sucks because this is not a cpp or c file I have, set it to use hlsl just so that some of the float4s and macros kinda highlight, one trick I could do is like if I was to add a if define here I could define spline instancing so that it would act like these macros would they would show up better essentially but I'm not going to do that because I, have done that before and then I forgot to remove it and I was wondering why everything was breaking and that was foolish, I'm a fool a damned fool so one major change that they've done here is they've collapsed all their spline data into one nicely compacted, array of float fours and you can see them like putting different properties into the so the w component is getting the spline roll and that's just a scalar and then this position is a vector so that we just use these properties, quite different how they used to do it yes so this is pretty much wrapped this exact thing almost if I remember correctly like we've done our own version of this I wonder if I still like all these defines yeah exactly so yeah we had we had done them before it was below and separate and now and that was an optimization because we didn't actually necessarily need everything that they were passing in like this smooth interp roll scale we're not using, but now that they've packed it down my thinking our thinking actually is that we're going to try to use their struct here their layout instead of using our custom floats as it'll be easier to upgrade in the future and, we can minimize the duplication of code it just works it just works so we've already merged so this file is this isn't like I'm not doing the full upgrade so anywhere you see use line instancing that's a macro that we've defined and I'll show you where so in the what's it, if I yeah so when you're declaring a vertex factory there's this wonderful function called modified compilation environment which it will call and you can pass in specific defines to use and this is ours which we have to have to use with the, when generating the shader so if we didn't have this, set defined in our cpp here the previous where'd it go, that's got to be a cliche right everybody who streams trying to do this stuff where'd it go where'd it go no I think that's just you that's just me thank you okay I thought that was your cat in the background that's your coat hanger yeah let's go ahead and I don't know if you can see the coffee stained hoodie on there I legit thought that was your cat sitting like on something it's it likes to perch high yeah I'm hoping my cats don't disturb me too much or or maybe I do because they're adorable, now where was I snoot oh yeah just that's where the defined that's where the defines being passed in from the cpp code and so that's something we always have to change just to make sure it's using this but now on to some actual development I think perhaps as, going through all these different, structs and classes would be way outside the scope of what this could ever potentially be, and I don't even have the full understanding of this system so here we've commented out spf mandatory and then with a funny comment this should not be optional so right now it compiles and works because we've set this to optional and the reason the mesh isn't showing up is because it's these parameters just don't exist and we need them all of these to actually get the correct instance locations and render it properly so the vertices are essentially just not non-existent because these parameters are not working so they should be this mandatory so I'm going to switch them now as some of you may guess if I so yeah this is where I just make it that makes it not read only, if I was to compile and run this I would get a shader error crash while booting, and that's something I'm aware of so I don't want to do that because it would just take long to show you how much it fails so now that they're mandatory we need to get these parameters in there