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

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 136

  • @ZiplawDev
    @ZiplawDev 3 роки тому +92

    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

    • @666-l7u
      @666-l7u 3 роки тому +26

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

    • @demondevilmon980
      @demondevilmon980 3 роки тому +4

      Amazing person! Thank you for the hint!

    • @bigmistqke
      @bigmistqke 2 роки тому

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

    • @AkioJunichiro
      @AkioJunichiro 2 роки тому +4

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

    • @bigmistqke
      @bigmistqke 2 роки тому

      @t r ye ye ur a transphobe 🥱

  • @hakanviajando
    @hakanviajando 9 років тому +16

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

  • @chanfort48
    @chanfort48 9 років тому +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?

  • @soviut
    @soviut 9 років тому +1

    Really great live demo with the bezier calculations.

  • @81gamer81
    @81gamer81 5 років тому +42

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

  • @monguskan
    @monguskan 7 років тому +1

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

  • @Tropicaya
    @Tropicaya 2 роки тому +5

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

  • @SullyWar
    @SullyWar 4 роки тому +12

    The speaker is now Freya Holmer and she does awesome tutorials on UA-cam!+

    • @stealcase
      @stealcase 4 роки тому +8

      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 3 роки тому +2

      Still a "he" though, biologically nothing changed

    • @tojynick
      @tojynick 3 роки тому +15

      ​@@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 2 роки тому

      @@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 Рік тому

      @@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".

  • @naikrovek
    @naikrovek 6 років тому +20

    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?

  • @ximecreature
    @ximecreature 6 років тому +2

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

  • @Bluequaz
    @Bluequaz 7 років тому

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

  • @wilsimarbr
    @wilsimarbr 6 років тому +3

    Excellent, best explanation so far. thks

  • @dans7934
    @dans7934 9 років тому +3

    Really enjoyable presentation, thanks Joachim

  • @vima9046
    @vima9046 2 роки тому +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!

  • @Betterog
    @Betterog 9 років тому

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

  • @-.._.-_...-_.._-..__..._.-.-.-
    @-.._.-_...-_.._-..__..._.-.-.- 2 роки тому +3

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

  • @010ChrisisCool
    @010ChrisisCool 6 років тому +1

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

  • @arthur.goldsmith
    @arthur.goldsmith 8 років тому

    This is a great talk, well done man.

  • @nottellinganyoneanything
    @nottellinganyoneanything 8 років тому

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

  • @marwanzaky9893
    @marwanzaky9893 4 роки тому +1

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

  • @Yunodye
    @Yunodye 7 років тому +6

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

  • @rbanister100
    @rbanister100 2 роки тому +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...

  • @TehGM
    @TehGM 9 років тому +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?

  • @shay88
    @shay88 9 років тому +9

    Will there be a demo project with this?

  • @Joviex
    @Joviex 9 років тому

    Excellent talk. Thank you for the knowledge.

  • @kubabest823
    @kubabest823 9 років тому

    Great presentation, I really enjoyed it.

  • @mbyb6817
    @mbyb6817 9 років тому +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 :)

  • @chikaBurton
    @chikaBurton 8 років тому

    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 7 років тому +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.

  • @bradjones7491
    @bradjones7491 7 років тому

    Thanks so much lovely tool for my current project.

  • @ArtemMELNYK
    @ArtemMELNYK 6 років тому +1

    Very good tutorial.

  • @yannickvanhoutte4403
    @yannickvanhoutte4403 5 років тому

    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!

  • @KaletheQuick
    @KaletheQuick 7 років тому +16

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

    • @muratkul7377
      @muratkul7377 6 років тому +6

      Me: what just happened?

    • @suriyaswami6507
      @suriyaswami6507 5 років тому +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.

  • @alexleonardi2
    @alexleonardi2 8 років тому

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

  • @juliengagneux4934
    @juliengagneux4934 8 років тому +1

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

  • @MTMRPG
    @MTMRPG 9 років тому

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

  • @TanukiDigital
    @TanukiDigital 7 років тому +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?

  • @oddixgames6704
    @oddixgames6704 6 років тому

    OMG this one is brilliant!

  • @lupinedreamexpress
    @lupinedreamexpress 6 років тому

    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.

  • @GrKl30
    @GrKl30 7 років тому

    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?

  • @isirapramodith8720
    @isirapramodith8720 6 років тому +1

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

  • @anonymoussloth6687
    @anonymoussloth6687 4 роки тому

    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

  • @videomasters2468
    @videomasters2468 8 років тому

    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 8 років тому

      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.

  • @lootwig2176
    @lootwig2176 9 років тому

    Nice explanation!

  • @willkuerlich
    @willkuerlich 6 років тому

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

  • @battlefield2lover
    @battlefield2lover 8 років тому +2

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

  • @ZoidbergForPresident
    @ZoidbergForPresident 9 років тому +1

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

  • @kevinmartinez8267
    @kevinmartinez8267 8 років тому +1

    its the code available? Great presentation!!

    • @kevinmartinez8267
      @kevinmartinez8267 8 років тому

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

  • @kodenkm
    @kodenkm 8 років тому

    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.

    • @kodenkm
      @kodenkm 8 років тому

      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 7 років тому

      Hi, How did you manage to extract the Shape2D ?

    • @kodenkm
      @kodenkm 7 років тому +1

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

    • @Athomield3D
      @Athomield3D 7 років тому

      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.

    • @kodenkm
      @kodenkm 7 років тому +1

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

  • @hariharanvn2169
    @hariharanvn2169 4 роки тому

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

  • @matthewcasey1703
    @matthewcasey1703 7 років тому

    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 7 років тому

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

  • @linezgames3893
    @linezgames3893 7 років тому +2

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

  • @Avaryes
    @Avaryes 8 років тому +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 8 років тому +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.

  • @davidmorris2916
    @davidmorris2916 6 років тому +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 6 років тому +1

      blender has splines by default.

  • @anonymoussloth6687
    @anonymoussloth6687 4 роки тому

    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 3 роки тому +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 3 роки тому

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

  • @MrDjJdr
    @MrDjJdr 9 років тому

    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 8 років тому

      +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 8 років тому

      h

  • @gblenemy
    @gblenemy 8 років тому

    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 8 років тому +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.

  • @SaintHedisTeam
    @SaintHedisTeam 9 років тому

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

  • @CariagaXIII
    @CariagaXIII 9 років тому

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

  • @RivenbladeS
    @RivenbladeS 5 років тому

    Is there some source code or demo with source files?

  • @DeepestDungeon
    @DeepestDungeon 6 років тому

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

  • @qinglai8051
    @qinglai8051 8 років тому

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

  • @insideyrmind4873
    @insideyrmind4873 2 роки тому

    Why is triCount = shape.lines.Length?

  • @-.._.-_...-_.._-..__..._.-.-.-
    @-.._.-_...-_.._-..__..._.-.-.- 2 роки тому +2

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

    • @moordegaai
      @moordegaai 2 роки тому +1

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

    • @-.._.-_...-_.._-..__..._.-.-.-
      @-.._.-_...-_.._-..__..._.-.-.- 2 роки тому +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 2 роки тому +1

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

  • @videomasters2468
    @videomasters2468 9 років тому

    @30:19 what is an "ExtrudeShape" ?

    • @videomasters2468
      @videomasters2468 9 років тому +7

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

    • @leonardozimbres
      @leonardozimbres 8 років тому

      +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 8 років тому +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.

  • @CaioTrinchinato
    @CaioTrinchinato 9 років тому

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

    • @filecorrupteddev9198
      @filecorrupteddev9198 9 років тому +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 9 років тому +1

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

  • @JeffJeffMe
    @JeffJeffMe 4 місяці тому

    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.

  • @StigDesign
    @StigDesign 9 років тому +1

    Awsome :D

  • @simpson6700
    @simpson6700 6 років тому +1

    how does that spaghetti monster of an intersection look nice?

    • @BeeBeeCoding
      @BeeBeeCoding 5 років тому +1

      its a master piece of bezier curves

  • @nottellinganyoneanything
    @nottellinganyoneanything 8 років тому

    DirectX defaults to nothing...

  • @lukaszimmermann4795
    @lukaszimmermann4795 9 років тому

    what program is he using for the presentation?

    • @lukaszimmermann4795
      @lukaszimmermann4795 9 років тому

      +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 9 років тому +1

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

    • @xinaesthetic
      @xinaesthetic 8 років тому

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

  • @necrondow_
    @necrondow_ 8 років тому

    Bet that one guy shouting 8 out feels like a fool

  • @Cgmausart
    @Cgmausart 9 років тому

    32:31 OMG

  • @didact777
    @didact777 4 роки тому +3

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

  • @banu6301
    @banu6301 8 років тому +2

    lel no dislikes

    • @Snackies
      @Snackies 8 років тому +2

      you jinxed it

    • @eddysteady3354
      @eddysteady3354 8 років тому

      +Snackies RUINED

    • @banu6301
      @banu6301 8 років тому +1

      +Eddy SKontorno omg ... are 5 years old ?

    • @eddysteady3354
      @eddysteady3354 8 років тому +1

      nu i-am dat eu dislike, ba englezule.

  • @heycross
    @heycross 5 років тому

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

    • @robosergTV
      @robosergTV 3 роки тому +1

      You have greater flexibility with code

    • @koyima
      @koyima 2 роки тому

      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....

  • @cory99998
    @cory99998 3 роки тому

    Cool tips but damn get to the point