Unite 2015 - A coder's guide to spline-based procedural geometry

Sdílet
Vložit
  • čas přidán 29. 08. 2024

Komentáře • 136

  • @ZiplawDev
    @ZiplawDev Před 3 lety +88

    For those watching in current year, this person is now called Freya Holmer, she has a great youtube channel focused on gamedev lessons, and it's the best I could recommend if you like math + gamedev

    • @user-dq3jv2xw5v
      @user-dq3jv2xw5v Před 3 lety +23

      So it is not only splines she has been bending, huh? :D

    • @demondevilmon980
      @demondevilmon980 Před 2 lety +4

      Amazing person! Thank you for the hint!

    • @bigmistqke
      @bigmistqke Před 2 lety

      Best channel of yt. If u wanna learn shaders, her intro is a must!!

    • @AkioJunichiro
      @AkioJunichiro Před 2 lety +3

      Lol I was like "hey this is exactly like Freya's bezier video"

    • @bigmistqke
      @bigmistqke Před 2 lety

      @t r ye ye ur a transphobe 🥱

  • @hakanviajando
    @hakanviajando Před 8 lety +16

    At 25:53 , Cross method should be from Vector3 class for those following along. Thanks Joachim for the lecture

  • @chanfort48
    @chanfort48 Před 8 lety +38

    Probably the most impressive talk from all Unite 2015 talks! I was wondering if splines could good approach to use for river paths generation on the terrain?

  • @SullyWar
    @SullyWar Před 4 lety +11

    The speaker is now Freya Holmer and she does awesome tutorials on CZcams!+

    • @stealcase
      @stealcase Před 4 lety +7

      Oh wow I didn't recognize!
      Definitely watch her stuff: she does amazing tutorials on her own channel as well as a great talk on simple useful Math for Programmers.

    • @robosergTV
      @robosergTV Před 3 lety +1

      Still a "he" though, biologically nothing changed

    • @tojynick
      @tojynick Před 3 lety +13

      ​@@robosergTV Biologically probably yeah, but gender definitely changed. And gender is all about self-identity, so calling Freya "he" is at least very rude and disrespectful.

    • @magnuscoles5010
      @magnuscoles5010 Před 2 lety

      @@robosergTV she gave you such a valuable information for free, the least you can do is to not act like an ass hole and respect her pronouns

    • @lahcenebelbachir7929
      @lahcenebelbachir7929 Před rokem

      @@magnuscoles5010 He couldn't respect his own gender, why should we.
      People like him should accept themselves as they are before forcing other people to accept their made up "identities".

  • @justgivemeanumber8215
    @justgivemeanumber8215 Před 2 lety +3

    The sound is out of sync. I solved it by opening another tab and aligning the sound on the phrase "before we get started". And keeping the video tab mute.

  • @81gamer81
    @81gamer81 Před 4 lety +40

    Me: Omg this is so complex
    10yr in audience: Can we do this in 4D?

  • @vima9046
    @vima9046 Před 2 lety +7

    Looks really interesting but it's very desynchronized, so for me it's difficult to follow the course! It's such a pity becuase i really like how Freya explain!

  • @soviut
    @soviut Před 8 lety +1

    Really great live demo with the bezier calculations.

  • @naikrovek
    @naikrovek Před 6 lety +19

    I wish there were more talks like this. Not just at Unite, but at any conference meant for developers. Everyone that uses Unity is a developer in some way, why can't Unite be full of talks like these?

  • @monguskan
    @monguskan Před 7 lety +1

    Thanks for sharing your knowledge. Great talk and contribution to the developers community.

  • @wilsimarbr
    @wilsimarbr Před 5 lety +3

    Excellent, best explanation so far. thks

  • @-.._.-_...-_.._-..__..._.-.-.-

    The audio is ahead of the video by 1 minute and 37 seconds.

  • @Tropicaya
    @Tropicaya Před 2 lety +5

    Why is the audio out of sync? It was never like this the first time I watched it.

  • @ximecreature
    @ximecreature Před 5 lety +2

    This was an excellent talk, dense in informations and yet very clear.

  • @dans7934
    @dans7934 Před 8 lety +3

    Really enjoyable presentation, thanks Joachim

  • @Bluequaz
    @Bluequaz Před 6 lety

    Extremely useful. Been looking for this for awhile. Thanks much!

  • @010ChrisisCool
    @010ChrisisCool Před 6 lety +1

    Will be trying to use this technique for a light spectrum in mist effect in my current unity project 🤞

  • @ongamex
    @ongamex Před 7 lety

    Additionally for the stretching there is a Berzier reparametrization to make the speed uniform.

  • @marwanzaky9893
    @marwanzaky9893 Před 4 lety +1

    Omg, this is so impressive thank you so much I learn a lot of things!

  • @rbanister100
    @rbanister100 Před 2 lety +1

    At 8:02, I can NOT believe that he did not explain that these coordinates need to be in a CLOCKWISE rotation, when defining them...

  • @arthur.goldsmith
    @arthur.goldsmith Před 8 lety

    This is a great talk, well done man.

  • @Joviex
    @Joviex Před 8 lety

    Excellent talk. Thank you for the knowledge.

  • @kubabest823
    @kubabest823 Před 8 lety

    Great presentation, I really enjoyed it.

  • @bradjones7491
    @bradjones7491 Před 7 lety

    Thanks so much lovely tool for my current project.

  • @Betterog
    @Betterog Před 8 lety

    This was an incredibly useful video, those mental tools really help. I like the comedy.

  • @Yunodye
    @Yunodye Před 7 lety +6

    Good video, but how could I combine multiple splines togheter?

  • @ArtemMELNYK
    @ArtemMELNYK Před 6 lety +1

    Very good tutorial.

  • @mbyb6817
    @mbyb6817 Před 8 lety +4

    Hey Joachim, great talk. Thanks!
    Is the unity example project (using roads) available somewhere? I find it easier to learn concepts like this with working code to experiment with :)

  • @shay88
    @shay88 Před 8 lety +9

    Will there be a demo project with this?

  • @battlefield2lover
    @battlefield2lover Před 8 lety +2

    28:36
    Mind = Blown.
    i always wondered how they did this.

  • @TehGM
    @TehGM Před 8 lety +4

    I still can't understand what ExtrudeShape is. I already have code to generate array of OrientedPoints for bezier. I have my Mesh. But I can't understand what shape.vert2Ds and shape.lines are.
    Can anyone help me?

  • @KaletheQuick
    @KaletheQuick Před 7 lety +16

    Me following along at home:
    "YAY! I did it! :D"

    • @muratkul7377
      @muratkul7377 Před 6 lety +6

      Me: what just happened?

    • @suriyaswami6507
      @suriyaswami6507 Před 5 lety +1

      @@muratkul7377 Hey, I am not able to run it. Can you please upload the code to some repo in github and share the URL? Will be a big help, thanks in advance.

  • @MTMRPG
    @MTMRPG Před 8 lety

    Great talk. Think I'm gonna try and apply this to create a water effect, should be fun.

  • @chikaBurton
    @chikaBurton Před 7 lety

    as I understand, there are no normals on vertices, because they have no orientations, they are just points in space, normals exist only on faces... correct me if I'm wrong, but normals on vertices exist only if they're part of the face (tri, quad or poly)

    • @peterm2044
      @peterm2044 Před 7 lety +2

      this is to allow the mesh to appear smooth. The normal value for any point on the face is an average for each vertex on that tri. So for a tri with Vertexes A B C, a point on the edge, halfway between A and B will have a normal value halfway between A and B. If A and B are both shared with a neighboring tri, by having their normals sit halfway between each of the triangles 'true normal' the edge will appear smooth. If the two neighbouring triangles each have vertices that point directly up (based on the 'true normal' of the triangle) then the edge between them will appear sharp.

  • @linezgames3893
    @linezgames3893 Před 6 lety +2

    54: 45 I love when the kid asked. The questions prior to the kid were ahhhhh Really thats what you're asking lol...

  • @oddixgames6704
    @oddixgames6704 Před 6 lety

    OMG this one is brilliant!

  • @lootwig2176
    @lootwig2176 Před 8 lety

    Nice explanation!

  • @TanukiDigital
    @TanukiDigital Před 7 lety +2

    Man, this is such a great talk, and yet getting a full working implementation is causing me some extreme difficulty! I followed along writing the code until about halfway through where things just start to break down with crucial elements having been left out of the presentation. Even using the full code implementation that was linked below in one of the comments... still no go for me. Does anyone have a working prototype of this in a unity project?

  • @GrKl30
    @GrKl30 Před 7 lety

    Hi all, for rails/roads created with this, we certainly later on need to find the exact length of the splines created to allow vehicules to move on them at constant speed. So: how do we find the length of the splines or how to move at constant speed on them?

  • @ZoidbergForPresident
    @ZoidbergForPresident Před 8 lety +1

    Very intesting introductory course, although I'm a bit lost because I'm no Math genius, but cool stuff. :P

  • @alexleonardi2
    @alexleonardi2 Před 7 lety

    Very informative, thank you. Why aren't the triangle coordinated stored in Vector3s but as sets of 3 of ints?

  • @Avaryes
    @Avaryes Před 8 lety +1

    14:20 Why cant we have one normal per triangle? Wouldn't this reduce the need for 24 vertices and 24 normals to 8 vertices uand 12 normals and conserve data?

    • @Bunny99s
      @Bunny99s Před 8 lety +3

      Because you have to specify all your data in vertices. The way Unity handles the different vertex attributes it a bit misleading. An actual vertex specification would be like this:
      struct Vertex
      {
      Vector3 position;
      Vector3 normal;
      Color color;
      }
      The different vertex attributes belong together. So mesh.vertices[5] and mesh.normals[5] are both part of the same vertex, the vertex with the index 5. If you had an actual seperate array for normals, you would need another index buffer so you can specify which normal belongs to which triangle. The same argument can be raised for every other vertex attribute (color, uv, uv2. uv3. uv4, tangent).
      Also not every triangle should be rendered flat. This might be true for a cube, but a sphere actually doesn't need the vertices to be split as you do want the same normal for all 4 quads that meat at that vertex. Specifying different normals for the corners of a triangle makes the triangle look "curved". At least the shading will create that look.
      Take a look at this page:
      en.wikipedia.org/wiki/Shading
      The two blue sphere's have the same triangles but different vertices. The left one actually needs 4 times the vertex count than the right one as each vertex normal is splitted, one for each quad. If you don't split your vertices you get the right picture.
      If you create a cube with only 8 vertices the shading would look like on a sphere.

  • @lupinedreamexpress
    @lupinedreamexpress Před 6 lety

    Can you apply banking by using t on the control points to rotate the object around its localized Z axis ?
    These work nice for flat curvy paths but banking is the issue.

  • @anonymoussloth6687
    @anonymoussloth6687 Před 3 lety

    at 25:30, how come we find binormal first then normal? arnt both orthogonal to the tangent? which mean the binormal could also be in multiple directions. plz explain someone

  • @yannickvanhoutte4403
    @yannickvanhoutte4403 Před 4 lety

    So I've got a problem with the evenly spacing out portion here.
    The methods Joachim provided are great for spacing out the distances along the bezier, which is great for UV spacing.
    However, suppose you'd want to move a separate object along this bezier (such as cars following the road), then you need smoothed out positions, not distances.
    Does anyone know how to obtain these? I've been trying a few things myself so far but I'm not succeeding I'm afraid.
    Cheers!

  • @juliengagneux4934
    @juliengagneux4934 Před 8 lety +1

    Hello. Thanks for this very good tutorial. May we have the source code and asset of the sample ?

  • @isirapramodith8720
    @isirapramodith8720 Před 6 lety +1

    im a beginner and this is so hard..the code is not working.. can anyone have a correct code

  • @willkuerlich
    @willkuerlich Před 6 lety

    anyone having the issue that the sampled lookup table values are going beneath 1? - when using shown implementation??

  • @davidmorris2916
    @davidmorris2916 Před 6 lety +1

    need to be able to export it to maya or blender so we can add it to background of a cgi project

    • @simpson6700
      @simpson6700 Před 5 lety +1

      blender has splines by default.

  • @CariagaXIII
    @CariagaXIII Před 8 lety

    left hand y up
    zbrush unity and directx i guess i don't have to worry on setting it up

  • @videomasters2468
    @videomasters2468 Před 8 lety

    if you created a bezier spline with more than four control points such as 6 to give greater control over the curve, how would you get a point on the spline as the method shown only uses the first four points ?

    • @Bunny99s
      @Bunny99s Před 8 lety

      You would have to derive your polynomial yourself ^^. The lerp method still applies but you would need more steps until you get your final point. A cubic bezier has 4 points a quadratic has 3 points and a linear has 2. So a hypercubic bezier would have 5 points.
      The term cubic / quadratic / linear applies to the highest polynomial factor. So a cubic bezier has t³, t² and t terms while a quadratic bezier only has t² and t. A greater contol point count would mean higher factors like t^4, t^5, ...
      bezier splines aren't really good at scaling the point count as the polynomial gets more and more complex. You might want to look up "Centripetal Catmull-Rom spline" on wikipedia. They allow an endless chain of controlpoints.

  • @matthewcasey1703
    @matthewcasey1703 Před 6 lety

    I'm really not sure what you mean by soft edge vs hard edge and why you need two vertices for a hard edge, could you please explain?

    • @matthewcasey1703
      @matthewcasey1703 Před 6 lety

      I believe it is so you can have two different normals at the edge.

  • @kevinmartinez8267
    @kevinmartinez8267 Před 8 lety +1

    its the code available? Great presentation!!

    • @kevinmartinez8267
      @kevinmartinez8267 Před 8 lety

      +Kevin Martinez i mean the example you show of how a bezier curve works not the code already on the slides!!

  • @hariharanvn2169
    @hariharanvn2169 Před 4 lety

    nothing mentioned about Extrude shape class but still using it at 30:25 , can anyone help me with this?

  • @qinglai8051
    @qinglai8051 Před 8 lety

    thanks for your talk. curvy plugin's author? it is every help for understanding curvy code.

  • @gblenemy
    @gblenemy Před 8 lety

    I managed to get a working curve. but I can't seem to generate a mesh from it. Tryed my best to recreate all the code from this video. But the triangleIndices are wrong.
    anyone here who made this work?

    • @Bunny99s
      @Bunny99s Před 8 lety +1

      An important thing about triangles was missing in the video. The winding order of your indices matters. A triangle always has a front side and a back side. In Unity the front side is the side where the points are winded clockwise.
      So if you specify 3 triangles where the points go counter clockwise you won't see the triangle because you look at the back side. Most shaders in Unity have enabled back-face culling so it won't render the back of a triangle. That's actually important since the vertex normals would point in the wrong direction for the backside so the lighting / shading would be wrong. So make sure your triangles are defined clockwise. I recommend a sheet of paper and a pencil to visualize your vertices and how the triangles has to be defined.

  • @kevinmillar6598
    @kevinmillar6598 Před 8 lety

    Thanks for you talk, its helped a great deal. I just have one issue left to fix that I can't figure out with the rotation on the axis in the direction of the road.
    I've put all the parts together from your code examples and got it up and running almost exactly the same (my version currently only runs in Play mode not Edit mode). The issue I have is I can't get the twist/roll rotation to work from either of the handle game objects. I can move them in all directions, rotate them left and right to make turns, rotate them up and down to make hills, but I can't roll rotate them to make the banking corners like you did when making the loop? The rotation values shown in the inspector update and the rotation gizmo rotates, but nothing happens with the road. Its like its locked to point up.
    Any help would be greatly appreciated.

    • @kevinmillar6598
      @kevinmillar6598 Před 8 lety

      Update: I found the issue. When building the OrientedPoint array i wasn't getting the up direction from the bezier control points. I was just setting it to Vector3.up directly. I changed it to a lerp between both start and end control point transform.up vectors and now its working correctly.
      Thanks again for the great talk!

    • @Athomield3D
      @Athomield3D Před 7 lety

      Hi, How did you manage to extract the Shape2D ?

    • @kevinmillar6598
      @kevinmillar6598 Před 7 lety +1

      Shape2D is just to hold a list of points to extrude along the path.

    • @Athomield3D
      @Athomield3D Před 7 lety

      Yes, but I really didn't get why it had to be a vector2 instead of a vector3 for position, since it's still a point in 3d space.

    • @kevinmillar6598
      @kevinmillar6598 Před 7 lety +1

      Athomield3D the third coordinate Z is the distance along the extruded path.

  • @insideyrmind4873
    @insideyrmind4873 Před 2 lety

    Why is triCount = shape.lines.Length?

  • @DeepestDungeon
    @DeepestDungeon Před 6 lety

    OK. Now, how to do crossroads with this technique?

  • @RivenbladeS
    @RivenbladeS Před 5 lety

    Is there some source code or demo with source files?

  • @MrDjJdr
    @MrDjJdr Před 8 lety

    at 27:15 can someone explain the hard edges and soft edges to me? it's not making sense to me why I don't have to double up vertices on each point, just the one there.

    • @Caldaron
      @Caldaron Před 8 lety

      +Joachim Holmér so the points 3 and 4 have the same slope as 2? Actually I'm confused because those point alls loke like they had agnles different than 180°
      or let me just ask a question: what defines a hard edge?

    • @gauravjindal007
      @gauravjindal007 Před 7 lety

      h

  • @SaintHedisTeam
    @SaintHedisTeam Před 8 lety

    Шикарно, но как это использовать совместно с физикой?

  • @anonymoussloth6687
    @anonymoussloth6687 Před 3 lety

    does anyone have a link to a resource that shows how to do this using shaders? I heard they are much better for procedural generation

    • @creationsmaxo
      @creationsmaxo Před 3 lety +1

      To do this through a shader, you have to modify the vertex input's struct which define the position of the vertex from which the textures are calculated onto. It depends on how your shader structure is being built (with or without pre-pass and stuff).
      Unlike building a mesh in Unity through its coordinates system which uses the scene's data as the absolute zero, shader uses either local or world space of the mesh as the absolute zero which which means that you got to implement some way, for the shader, to generate a sort of data that can be read by the engine to update anything non-visual-related.
      As an example, the Curved World (both the original and 2020 versions) plugin/tool uses the trick of adding values to the vertex (in the shader) to move them based on the distance (depth) from the renderer (camera). Even if you use the tool to create a spherical world out of a plane (like a small planet), you still need to implement a 2D-based relocation on the 2D plane to make it so that walking around the whole "sphere" does return to the start as, in reality, it's just a plane being curved only visually and physics are not affected by any shader unless you forcefully extract the data out of the shader.
      One thing to remember about building logic through shaders is that shader don't have the whole "access" nor tools as, for example, mono-behavior has. For example Conditionals (if() else() for() etc.) can be used only through extensions which are not compatible with every device (Most Intel HD GPU and some mobiles GPU/CPU can't render a shader with those in place).
      The good part of shader for procedural generation is not the rendering of the world itself (it can help, but not much), but the rendering of patterns. For example, rendering grass and terrains-related elements can be done through a single shader and, yes, that's a lot more faster and efficient than building the tiny rocks and grass in the actual world. Volumetric Water can also be generated by the shader dynamically. But even if all that works wonderfully, you'll still have to build a way, in the shader, to generate a readable flow of data for the engine to build upon such as physics/collisions.
      If you want to discover the starting point of understanding the concept of modifying the vertex through shader (hence creating new geometry out of a shader), I suggest you start by reading tutorials about how to generate celshading look. One trick called the "Outer layer" or "Double pass" is to generate 2x the vertex (through the shader) where the 1st pass is the outline color and slightly bigger (through reversed normal direction) and the 2nd pass overwrite a smaller with the actual textures. That trick with the 1st pass can be used for anything. For example, it's possible to used it to generate a world's endless water at a precise world's height or to generate a depot of white snow building up on to of anything in the world based on the 3D orientation of each asset.

    • @anonymoussloth6687
      @anonymoussloth6687 Před 3 lety

      @@creationsmaxo do you have any specific resources or recommendations from where I can learn this stuff?

  • @StigDesign
    @StigDesign Před 8 lety +1

    Awsome :D

  • @JeffJeffMe
    @JeffJeffMe Před měsícem

    Oh man, I miss the good old unity videos. They used to be so useful and interesting.
    Now days are just the default shallow content for beginners or cash-grabbing advertisements.

  • @-.._.-_...-_.._-..__..._.-.-.-

    Is it me or is the audio way out of sync?

    • @moordegaai
      @moordegaai Před 2 lety +1

      Jump same here. Since no one is talking about it I feel like it's some sort of recent glitch.

    • @-.._.-_...-_.._-..__..._.-.-.-
      @-.._.-_...-_.._-..__..._.-.-.- Před 2 lety +2

      @@moordegaai I found the sound isn't out of sync on my phone, so it must be a desktop browser thing. I ended up downloading the video and watching it that way. The sound was fine that way.

    • @moordegaai
      @moordegaai Před 2 lety +1

      @@-.._.-_...-_.._-..__..._.-.-.- oh yeah, you're right! Its fine on my phone too. Thanks!

  • @videomasters2468
    @videomasters2468 Před 8 lety

    @30:19 what is an "ExtrudeShape" ?

    • @videomasters2468
      @videomasters2468 Před 8 lety +7

      +Joachim Holmér would it be possible for you to release the source code for the demo ?

    • @leonardozimbres
      @leonardozimbres Před 8 lety

      +Joachim Holmér I want to say thanks too, for the great presentation. Direct to the point. I've seen that the ExtrudeShape class is indeed on the video, (not on code, but it's there, with single different var names). It's great that you may use it to model your 2d model by code.
      May I ask for a little help? I would love to use meshes like "cave walls", to use the bezier to shape these walls. What would I need in this case? Some kind of deformer? What would be good to check out on this direction?

    • @videomasters2468
      @videomasters2468 Před 8 lety +1

      +Joachim Holmér @40:18 in the inspector there is an extrude mesh field named "Shape" where you have dropped an object called, "Road". What is that ? Is it a 3d model that you have imported, i now kind of understand what the extrude shape is but dont know how you actually give it the shape to extrude.

  • @simpson6700
    @simpson6700 Před 5 lety +1

    how does that spaghetti monster of an intersection look nice?

    • @BeeBeeCoding
      @BeeBeeCoding Před 5 lety +1

      its a master piece of bezier curves

  • @CaioTrinchinato
    @CaioTrinchinato Před 8 lety

    I was under the impression that the code would be available...

    • @filecorrupteddev9198
      @filecorrupteddev9198 Před 8 lety +1

      +Caio Trinchinato It is. Watch the video, copy what is there, and fill in the gaps and connect everything together. Really not that hard.

    • @CaioTrinchinato
      @CaioTrinchinato Před 8 lety +1

      +FileCorruptedDev I know. It's just that promises were made and dreams were broken =(

  • @ongamex
    @ongamex Před 7 lety

    DirectX defaults to nothing...

    • @ongamex
      @ongamex Před 7 lety

      There is no default it is what you write..

  • @lukaszimmermann4795
    @lukaszimmermann4795 Před 8 lety

    what program is he using for the presentation?

    • @lukaszimmermann4795
      @lukaszimmermann4795 Před 8 lety

      +Joachim Holmér Tack för svaret och presentationen. Har tyvärr inte fattat allting, men någon gång ska jag tittar på videon igen och så kan jag förhoppningsvis mer om programmering och unity. Tack

    • @videomasters2468
      @videomasters2468 Před 8 lety +1

      +Joachim Holmér @30:19 what is an "ExtrudeShape" ?

    • @xinaesthetic
      @xinaesthetic Před 8 lety

      +videomasters2468 I realise the previous comment was 5 months ago, but I'm guessing "ExtrudeShape" is an encapsulation of what's shown @ ~28:28

  • @Cgmausart
    @Cgmausart Před 8 lety

    32:31 OMG

  • @didact777
    @didact777 Před 4 lety +3

    this guy is now a gal !! that is the omg part !!!

  • @necrondow_
    @necrondow_ Před 8 lety

    Bet that one guy shouting 8 out feels like a fool

  • @cory99998
    @cory99998 Před 3 lety

    Cool tips but damn get to the point

  • @banu6301
    @banu6301 Před 8 lety +2

    lel no dislikes

  • @heycross
    @heycross Před 4 lety

    My god.. So much work for just a couple of nodes in ue4

    • @robosergTV
      @robosergTV Před 3 lety +1

      You have greater flexibility with code

    • @koyima
      @koyima Před 2 lety

      Someone wrote this for you, they did the work and you are just using it. This is different: you are making the "nodes". There are tons of tools you can get to do this for you "with a couple of nodes" that is not the point - also this is from 2015, Unreal 4 was out in 2014, I remember the engine back then, they wanted royalties for everything....