Houdini Algorithmic Live #126 - Lenticular Effect Simulation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign hello hello can you hear me all right okay I think I'm ready okay so it's about time uh let me get started hello this is Junior horikao and this is the a Houdini algorithm algorithmic life a tutorial live for Houdini doing this weekly and today this is 126 episode and the topic for today is to create assimilations for a land so-called lentil killer effect and I have already have some comments uh I'm going to simulate the refractions or making Shader that change with the angle um I am going to use the refraction um procedurally or geometrically um and so I'm not going to create a Shader but instead I'm just going to um do this more attribute way okay and Houdini so that I might be able to use it for maybe a digital fabrication later if there is a way to precisely make the product so that's my interest I mean so that's what I'm gonna try to do and the things that I'm going to try to do is to create a lenty killer lens like these and doing the kind of effect creating a lenticular-like effect like these by changing the angle of the camera by calculating the refraction based on the refraction index of the material for example using acrylic the reflection index of the acrylic is about 0.1.49 so this is the result of using that index and you can also change these procedurally you can also change the amount of lenses per angle or you can also change the scale like the height of the lens itself you can also change the depths of the lens which will change how you how it will look how it will look like from the camera so it'll be uh I think it's pretty interesting in terms of the physics simulation it's freely physics based simulation so could be used for digital fabrication probably so let's do this and before going to do this let's look at how lenticular lens work by looking at some of the website now this is one from some website that I found on Google search it shows some nice illustrations so first you create a lens like you know you you first have the lens like these having some depths and some oval shape lengths like these by and by looking at these lengths from the angle since this material this lens has its refraction index for example if they if it is acrylic The View angle when it's being penetrated through the material it will bend based on the fraction so the image that you're going to see actually is the the goal of the Bandit Direction so in this illustration it looks straight but actually it will bend a little bit based on the in refraction index and if the height is really big if you have a more High dense refraction the depending will get greater or the height of the lens itself also changes how the direction bends or changes okay So based on those uh parameters you can kind of control how the image looks like underneath and by having a lot of images separated for each lens like these into the laced image you can change the image based on the angle and which angle you see you can change what add image to show for example from this angle in this case you see red image in this angle you see only a green image so so that's what I am going to try out here the history is pretty old and it's pretty traditional way to create it but if you do this virtually it's not really um limited to a straight lens actually but it could also be like curved lens so you could try almost any kind of shape based using the base using the same equations so that might be interesting if it is possible to fabricate well let's see so that's what I'm going to try to create and hopefully you'll find it interesting okay so let's do this from scratch today I'm using a 3D mouse so that I can smoothly change the 3D view of the camera which will which is which works pretty well with this lenticular effect so if you have one I'll recommend it hmm I have a host some other questions so if you just create the lens with Ray tracing it should work by default right probably yeah in the renderings it should work yes yep so let's do this because right tracing is based on the physics uh I suppose so should work but today I'm just going to do this a procedural way I mean geometrical way instead of using shaders right right so practically it might not be really useful for most of you guys but just for interest okay so let's do this um first I am going to create a base grid starting from a base grid okay and try to create a initial lens layers first so let's do that [Music] um I guess there are many ways to do this let me think what's the best way I mean you could change the rows and columns to change the number of lens I guess so maybe I could use these columns as the number of lenses let's do that I'm going to create a new node have a initial parameter defining how many lens you wanna have okay let's say from 1 to 100 Maybe 500 maximum okay let's copy this parameter to a column so this will be a number of lenses now for the rows you could specify any numbers it's just related to the resolutions of your final image so I'll set it to 50 for now and come back later to see if it's gonna to see if I need to raise this up a little bit um and next thing I would like I need to do is to make these make each primitive rounded up like an oval shape so let's think what's the easiest way to do I mean just by having a circle placed in here or tube shape placed in these primitive area might be the easiest way so let's just do that in those cases maybe I can set the rows to two so that I have only a single rectangles per lenses per lens so now I could use a cylinder or tube shape okay and let's try to copy this Cube to each primitive areas so in order to do that you need to know the center of each primitive the direction and the diameter okay so let's calculate that so that has to be done per primitive I am going to use the Primitive angle and Center info okay let's create some attribute to this um uh let's first create a Center Point per primitive so that is and PT accessing 2A at p adding one point at at P that P is the center of the Grid or a square I mean the rectangle and then you could remove the original rectangle like that so now you have points now you also want to get the the width and the depth of this lens the width can be used as the diameter and the The Depths can be used as the the Z size okay so where can we get that um we could actually go back to this parameters and calculate it um by dividing those size the original size by these so let's do that I'm going to make one parameter um diameter and the depths or well I'll just call this depths okay first of all the depths is pretty easy because it's just 10 and since I was splitting columns uh I think this value is the length isn't it yeah so I'm going to copy this value here to the depths okay for the diameter I could just divide this value by a number of columns okay let's make sure this is correct by making the lens size really small like for four or five so that this size has to be 2.5 if you have two lenses maybe it's you need to subtract this value by one let's check yeah so it's not 2.5 so I think I need to subtract this by one okay now it's correct all right so now it should be related to the lens numbers and the size of the original grid okay now I have diameter and the depth so I can use this as a scale attribute so um I'm gonna create a scale Vector value then uh for the X I'm going to create and set it as diameter and for the height value the height value can actually be related to the diameter I guess so for now I'm going to say set the same diameter value and for the Z value I'm going to use the depths okay now let's apply this to a point by set point address scale which can be used with the copy to Salt node what was the point name PT all right and let's check the point attribute so I have scale like that now go let's go back to this tube let's see okay now I also need to specify the direction for this for the orientation of this tube so it's set point address normal not sure which way is the correct direction so for now I'm going to set it at to the direction probably I might need to change it okay so I have the points with the scale and the normal now it's time I try out copy two points see if it's gonna work okay something is obviously wrong probably the direction is wrong so let's change this to a X or Y I don't know I'll try with the X first yep wrong how about these okay the direction is correct but the size is wrong so let's change uh um this one to a dips this one to a diameter okay now it seems to work all right and I only need the top half of the tube so let's make this half sized um first of all I'm going to make this as a even number column and how am I able to split it into 180 degrees maybe there are no parameters for that for tube okay then I'll just use clip this everybody okay so like that now I have a rounded lens shape like these and I also put I also want to control the oval height of these lenses so that it will affect how the direction refract or bend when seeing through these lenses also I also want to change the height as well maybe like I could do that later but for the the depths of the lens I could actually do it here which is related to either this one or this one let me try with Z1 okay so this D by changing the scale of the value you could kind of control how high or how steep is it how steep it the lens is so I'm going to create a parameter here how do I call this lens um roundness okay so how you have it has to be more than zero in order to have some band but it could be could go over one as well to have more steep curve I mean physically you might not find a lens like these but in the simulation anything is possible so let's just do it yeah looks good so let's have this promoted to the controller node all right what else um okay that I think that's fine and next you might want to change the height let's assume that you this is placed on the ground and you might want to have some space to the to the end of the edge of these lens to the ground so you might want to erase these lenses up a little bit that also affect how it burns how the view Direction vents so let's just give a transform node and let user decide how much they want to raise up the lens okay so let's have that as a parameter okay and copy this paste it not here paste it here okay right so in terms of the lens this is all you need to do and you might also want to divide these lenses so that you can set different colors per vertices and more res you have more high res image you get as the final result so it's up to you you just need to increase the the rows here in order to increase the resolutions well now I'm going to limit this to low number and go come back here later to have more high-res image so this could also be a parameter you want to change so let's give the rolls is vertical resolutions and the column is the lens resolutions or The Rounders the resolutions okay all right so in terms of the lens that I want to try out I'm ready so it's now you create a image underneath to use it for a simulations lenticular effect simulations so the thing you still need to do is to create decide how many images how many image you want to use in order to change based on the direction you look looking at this lens could be two the minimum could be two the maximum could be any number so let's have that parameter image number and well let's set the minimum to two uh okay I have a comment I have a question from Soto Monte sorry if this is usually asked but how are you moving the camera so I am using a 3D mouse uh the maker is 3D connection connection and by using this 3D mouse you could like smoothly change the camera just my route just by moving your 3D mouse like these so it's a lot better than using a single like 2D Mouse in terms of changing the camera view but it's a bit a little bit harder to control as well if you get used to it it's pretty nice okay so um let's try to create the image underneath so um I guess it might it could be interesting it would be interesting if I could just create some animated uh image for divided image so for example the pig looking at the left side pick looking at the four the forward pick looking at the right side and so on by having those image similar image you could create kind of a create a smooth animations if you have tons of split tons of Divisions per lens so let's create that kind of animated image so let's do that [Music] um so in the example that I made previously I used pickhead but for this example let's try using different test geometry like rubber toy it's no difference so first thing you might want to do is to define the direction which from which direction you want to create the image so probably I wanna create the front side of the view and rotate this like these to animate that might be suitable for a lenticular effect as well so in order to do this you the image you want to have is this View but the grid that I have is on XC plane so I'm going first I'm going to rotate this um rubber toy so that it will align with this grid okay so first I am going to rotate this um do i x negative 90 degrees okay let's also scale this up a little bit um if you wanna automatically scale this based on the base grid then you can do this um expression way or using Wrangle either way let's use Wrangle White in order to do that you need to refer to the original grid so connect that to a second input and what you first you want to do is to get the center of the grid which can be kit by get box center you also want to get the size of the bounding box from the second input so get the box size okay having those two you could actually scale this to a correct amount of value so let's do that first I am going to calculate the current centroid of this rubber toy let's call this season SN using the same functions the first input now first thing you want to do is to move this to the centroid of the grid so create the vector value which let's call this t as a Target and this as a source so the Direction the moving Direction [Music] is T Center minus s Center Soul Center and by moving the point attribute by the move Direction first it will align to it will move to the centroid of the grid okay next you want to scale this so you've the next thing you want to do is to get the source bounding box size which can be retrieved by using the same function here from an input 0. now that you have this value and the target value you could you know how much you need to scale these up in order to fit with the bounding box so the scale ratio can be calculated by T size divided by S size now in this case X Y and Z coordinate will have different size so you need to choose either X Y or Z in order to uniformly scale now you could just get the smallest I guess the largest might go off the boundary so I'll just choose the smallest in this case so the small list scale out of X Y and Z coordinate of this scale can be retrieved by using Min function two times first compare X and Y and get the minimum then compare the value with Z value so that you get the minimum out of three coordinate and you could use this to scale the point but before doing that you need to move the the centroid of this geometry to this uh to the zero zero zero positions but this grid is already at the zero zero zero position so I don't think you need to move this at all so you can just multiply the current Point positions with this minimum scale and where did it go okay I realized that the Z the Y scale of this grid is zero so you actually you don't really need to use this scale y I realized so just need one minimum all right that'll fit the grid and you might want to have some margins so in order to have some margins you could increase d The Source size here by some amount I don't know how much call this offset or margin I get okay let's make this 0.2 for now okay now now that I have a or geometry aligned to a grid let's also make some animations um or maybe not let's try to actually I would I need to test if it still fits when I rotate this rubber toy if I animate this oops using in this case z axis what I'm going to I want to make sure this fits this still fits inside the grid okay looks good okay so I guess I want to start from when the angle is 90 degrees and then gradually change this to a negative 90 degrees okay so I'm gonna make this as a starting point okay now next thing I would like to do is to um using the value that I have here how many like Grid or how many image I I want for each lens I this will also be the amount of animated object in this case if it's if the number is 3 then you have left side front side and the right side okay so to make those image per to make each image I am going to use a for each number I might just be able to do this all in Wrangle but might be not it's not really clear what's going on inside the code so by using these for each little bit might look a little bit clearer what's going on here it's a bit slower but um in order to prototype I think it's better Okay so um what I'm going to do is I am going to try to use the original grid here to scale uh for each Loop in the first Loop I'm going to scale each grid and place it somewhere around here and on the second Loop I'm gonna place it right here with the one third scale and on the last Loop I'm going to place the one third lay scaled grid here so I'm going to connect the grid here then first let's decide the scale using um it could be primitive Wrangle or it could be Point Wrangle let's just use primitive wrangle okay and let's connect the the for each count node to the Primitive as well and then let's call this size um how to split size split an image size okay and the number of loop has to be equal to the number of splitted image so per lens so let's copy this paste it here okay so you the iteration value coming from this meta node will be 0 1 and 2. if you look at the detail this one so I could use this to Define where the Primitive should go okay okay so let's first and you also you could also get the number of iterations which is also a number of split use accessing the num num iterations attribute so let's have two attributes coming from the second input one is the iteration which will be zero one and two and the number of iterations which will be three in this case okay now let's uh scale this first so the scale is one divided by the number of iterations so the SC is 1 divided by num iterations now you wanna access to the each point of the Primitive so that you can actually scale it so and one thing that I need to do before scaling it you need to separate or separate the point which is currently being connected at each point you meaning I need to you make each point unique something like by using unique points so that you can actually separate the grid so previously the number of points was 110 but now it's by using a unique point you it becomes 216 points and you could separate the grid like that yeah without having unique points you're going to just deform the Primitive so this is necessary okay so let's scale this in order to do that let's access to the point for each primitive using Prim points Loop through all the points accessing to the point number you could also get the point position now in order to scale you first need to move this point position to a you need to move this based on the pivot Center of each grid and for each grid the pivot Center could be on at the corner one of the corner of this grid and in this case I might want to make this as a momentum I want to make the left bottom corner to be the the pivot center for the scaling so to do that I need to kind of retrieve this point position here which I could do that by let's see the easiest way is to get the boundary box off each primitive and just get the minimum positions I guess so I'll just use for each primitive all use a function called get bbox and using in order to specify which primitive to use for the minimum and maximum I'm gonna use this primitive group so i2a convert the current primitive number to a group I'll get a minimum maximum for each primitive right now that I have this minimum value I'm going to use this as a pivot Center 4D scale so in order to do that first subtract the position for each primitive with the minimum then scale the x coordinate off the position by the scale value that I created then move this back to the minimum position now let's see and I need to update the current Point position using set point Drive to the point with this newly created Point position okay where did it go I think I did something wrong here let's see why um let me check if I'm getting first of all I'm good if I'm getting the right minimum value so in order to check the primitive let's see the minimum yeah I'm getting the minimum value correctly so that's good right now let's see if I'm getting the scale correctly scale is zero so this is wrong I'm not I'm okay so this has to be one because I'm getting the value from the second input okay so that was the mistake okay now the value seems correct and hopefully I am getting the right scale okay so the each grid has been scaled one third now it's time to move the grid based on the number of iterations if the iteration is equal to zero it could stay here if the iteration is equal to one it should move to the center if the iterations is equal to two then it should move to the right side so iteration is this value and the amount of movement can be defined by this SC here so after scaling I could add x value by ASC multiplied by the iteration there we go and as a result if you go out of the loop something must be wrong go back and see what's wrong here the original grid looks like okay so it's obviously going out the boundaries so something must be really wrong okay so um actually this is just a scale and this should not be the amount of the movement the amount of the movement is actually the the scale multiplied by the width of each uh lens so I need to have that information as well which can be retrieved somewhere around here which I already have it calculated here so I can just copy this parameter and refer to that information using an input okay paste that okay so this is the diameter so I need to multiply the diameter as well okay now let's go outside a loop and now I have three image three bars as one set per lens okay and should work even if I change the number of image per lens like that okay it's good okay so I'll just go continue with three but later I'm going to try to see if it still works with larger numbers Okay so the split for each grid is done next um next thing is to transfer the color informations from this geometry to the grid and in order to transfer the color value you could either transfer the color to A Primitive attribute or a point attribute um either way is fine in this case I am going to transfer the color to each primitive meaning um wait a minute let me think which way is better [Music] in this case maybe for the flat image it might be better to transfer the color on a point probably so I'll just do that way so in order to do that let me think um how would I how I would do let me see the things that I need to consider is whether I want to make high res in terms of these each bar in order to transfer the image from those animated objects Well for now let's just use one grid as a split number for a horizontal Direction but later in my I might need to I might wanna make it more high-res in order to get the the final image as high-res okay well but at least I do need to split this vertically because currently I don't have any point on a vertical vertical directions so let's do that um to do that well what's the best way one of the ways to use divide node and I think I could do this right here and instead of triangulating I am I could use this Bricker polygon to decide how many like offset that I want or divisions that I want vertically by changing in this case at Z Direction here so by Phi make this smaller you have more split vertically like that you could also do the same things for the X direction if you make this smaller you have more split on next direction as well so these could be parametrized I guess let's do that go to the controller this is really not an important parameter but uh let's have it vertical imageless ah which is a bit confusing because I already have it here for the lens so let's make sure this is for the lens and this is for the image I'm going to use a separator here for the vertical one I'm gonna name this lens okay and for the image one I'm gonna name this image pretty cool resolution from zero to one and same for the horizontal also I'm gonna duplicate this okay all right okay hello uh damage control uh since we can use Python code can we get a remote connection to WSL server to create some crazy AI based art like sending some point groups or renderings to AI to detect face or pauses yeah I think it's totally possible for sure I haven't tried it but I could see it's possible you might need to have some event uh set using python in order to trigger some functions based on those event but I think it's totally possible in any software Okay so let's copy this um going back to the Divide copy the vertical to here and copy the horizontal through here X okay now I'm just going to change the vertical resolutions for now to have bunch off grids points okay now let's transfer the color to this strip think in order to transfer the strip I could just I don't know refer to just I could just color each grid this Square like a pixelized image okay so shall we do that and to do that you could use a primitive wrangle accessing to those each strip and you might what you want to do is to transfer the color which is coming from this rubber toy to here now to do that you kind of need to make this also animated based on the iteration number here coming from this for each count so I could either use transform node or Point wrangle either way is fine if I if I need to if I want to use transform with an expression what I need to change is this value here so first I can access to a for each count iteration value should be from zero to two and then I want to remap this value to in an angle from 0 to 180 degrees or minus 180 degrees so what I could do is to fit this value remap this value using fit function which is always custom from 0 to the maximum number of Loop which can be copied from here so let's paste this -1 is the maximum for the iterations and then remap to 0 to 180 degrees that'll do hopefully currently the iteration number is zero so should be correct and if the iteration number is to then this should rotate this rubber toy to the right side okay so it is rotating so it looks fine now that the rubber toy is rotating based on the iterations you just need to copy the color informations to the strip now this is the tricky part because while you're going to while you want to transfer is the color coming from the texture not the color attribute in this case if you look at the point attribute or the Primitive attribute you see that there is no color attribute to this toy so you kind of need to get a sample or the texture applied to this geometry convert it into a color value so um to do that you need to use a function called color map I'll show you how you use that let me search for the functions that's more related to the Shader Coatings but you could also use it on soap context so it's really handy so this is the functions that I'm going to use by using this you can sample the texture file using UV and as a result you can get the color value or with the alpha but I don't need the alpha so we just need the vector value so if you know the path to the texture file you could actually get the color attribute using UV so that sounds interesting so in order to get the color informations from this rubber toy you need to know two informations one is the the file path to the texture and the UV to occur specific point position the UV is easy you just need to look for a UV attribute which is stored on vertex in this case so this is the one you need and the other informations the texture path file pass will can be retrieved from this shop material path okay with which leads to a Shader um Direction let's first look at this Shader which is inside the test geometry shopnet toy Shader so if I double click here there is a shopnet and there's a toy Shader and probably most of the materials are using principle Shader so every principle Shader has this parameter like texture here and this is the actual texture file path of this material so what I want to do is to some refer to this the channel parameter Channel from the shop material path Okay so so let's look at the name of the texture which in this case this is locked so I cannot really look at how it how the parameter name looks like so just gonna go to the material and create one principle Shader check the edit parameter interface and check which parameter that I need to retrieve and probably this is the one so under the base color there's a texture and the parameter name is called base color texture so this is the channel this is the parameter I want to refer to from the principle Shader in order to get the file path of the material okay so remember that face color under texture was it yep now going back to the geometry node I am going to get the actual text texture file name using those information that I just got Okay so first thing first let's get the first I need to create I need to get the corresponding Point position for each grid a bob so it if if I'm looking at this grid then I need to get the corresponding color at this position from the rubber toy the first thing I could do is to get the corresponding Point position off at this point which is somewhere around here and you can do that by using function like intersect so let's do that so first create the output Vector value like uh enter sected position and UV that will be careful this UV is not the one that I need in in order to refer to in order to sample the texture this UV is a primitive UV so I'm just I'm gonna name this Pub so that it's less confusing from UV this is this Frame UV is different from the texture UV so that's one thing you need to be careful of now let's calculate the intersections intercept starting from the really high positions and make the ray underneath so intersecting to the second input starting from the current grid Point position plus really high positions like thousand I'm not sure if this is enough and then make the direction which could be a negative the Y Direction could be more than thousands or ten thousand and get the intersected positions and the Prem UV well actually I don't want to use premium UV as a name because this is the name of the function as well so I'm gonna p and I'm gonna name this pruv k now hopefully I'll get the intersected point Let's test let's create a point position a new point at an intersected position see if I'm getting the point on top of the surface and if I enable these yeah yeah I am getting okay so that looks good I am getting the intersected Point positions now what I want to get all of this information is the shop material path primitive attribute and d u v so first let's get the UV UV can retrieve by using frame UV function and the Primitive number is the the information that I want to get is the UV and the Primitive number is intersected value here and the PR UV is the associated primitive UV in order to sample the value I also want to make sure that if the intersection is available there is a chance that there is no intersection so in those case I can just make the color black else make the color black okay now that I got the UV value I also want to get the shop material path I use accessing to the Primitive attribute from the second input Sharp material path at intersected primitive number now I'm gonna make sure this attribute name is correct let's check so shop underscore material path okay it's wrong shop material path okay so this should be the correct attribute name and hopefully I'm getting some information here let's check I'm going on check it by copying this value to some random attribute oh okay yeah I'm getting here so this is where I am getting the intersection let's also check the UV okay so I also I'm also getting the UV as well okay now it's time to get the file path for the texture for this material so in order to get that you can use a so this is the path to the node and if you look at it carefully where is it if you look at the material shop path this is the the node path so by adding uh adding what's it called um slash um with a name of the parameter and and that was color base color texture you should be able to access the access to the file name of the texture so let's try so string extra name text is equal to CH s which is for the which is in order to access the string parameter is shop material path Plus slash base color texture let's check I'm gonna make an attribute called a see if I'm getting any name here there you go so this is the file name that I want to access and this is by and by using these file path for the texture you can use the function called color map in order to sample the color all right so let's do that how do I use it um color map the first parameter is the file path and the second parameter is the UV okay so CD is equal to color map and texture file path to UV then I don't need this anymore now let's check there you go so I have successfully retrieved the color information from the texture information all right and looks like this as a final result sting all right so as I set up I think this is fine so next I am going to actually calculate the refraction by changing the directional View together with the roundness of this red lens to pick up the color underneath which is these okay Okay so let's do this so the and I want to transfer the color to the lens itself so probably I need more resolutions to the vertical Direction maybe I can go back here increase the the maximum number of the vertical lens here to have more divisions I don't know I mean I could go with 50 for now and make this larger later okay so um the I could transfer the color either to a point attribute or to the Primitive attribute I mean either way is fine in this case let me check what I did previously so I think I use the point to transfer so I'll just do the Point transferring going to transfer the color to each point for this lens pick up the color from the bottom bottom plane which has these information so connect this here and connect this to the second input and this is the actual lenticular effect equations that I'm going to create make sure this is at the same positions yep all right so one in one another information that I need is this the current camera Direction okay in order to calculate the refraction so and bend the direction The View Direction so let's create the camera view I'm going to click the camera with an option okay and make this locked so that the camera will be moved with the view all right now let's get this directional information there's two ways to do that one way is to use these copy these value and use it to estimate the direction or one and one another way is to uh get that informations by from the camera Matrix so either way is fine or actually the direction itself is actually a the current the direction from the camera to each point on the lens so if you just get the camera positions and that's all you need to have so in those case maybe you can just copy this translate value which is the easiest I think and use it here create the vector input and copy the value here there you go okay so having this camera positions you can also calculate the uh the camera view camera Direction by subtracting the current Point position on the lens with the camera pulling position it's also normalized this so that the size will be equal to one all right now now that I have this camera directions it's time you calculate the refraction at each lens by calculating the refraction you can you can estimate the bended Direction when your camera Direction penetrates or touches the lens the direction should bend to some direct some other directions based on the the angle of this lens and the depths I mean depth doesn't really matter in terms of the direction it's just based on this uh the curvature of this lens and in order to calculate d how much it bends or what's the final direction for the refraction refracted directions you could actually use a simple functions coming from the Vex I found out that there is a function just for the refraction called refract so you could just use this to get the bended directions using the fractions three informations you need one is the Direction of your camera one is the normal of the lens and the refraction index which will be tied to a material if you're using acrylic then the value is about 1.49 so let's create a parameter called refraction index refraction call this index here okay and let's make this 1.49 consider this is acrylic okay make this maximum to two now um and uh next I also want to get the normal Direction at each point of this lens so in order to have that probably need to calculate the normal beforehand to use point check okay looks good so I'm going to use this direction to calculate the bend bended Direction bended camera Direction Okay so let's go back and calculate it using this handy function shall we so the actual uh bent Direction is refract camera view and negative normal Direction which is negative at 10. and you're going to use this refraction index to calculate how much it bends okay now let's check this Direction I am going to apply this to a bent Direction see how it looks like let's visualize this using marker with the vector now I don't want to change the camera view so I'm going to create another view here in order to see Okay so am I seeing any views here okay let's make sure this okay I haven't applied to the attribute yet somehow okay now okay I kind of wanted to see here but uh not seeing here just seeing here well but I can see that the direction is being bent hopefully not sure it's a bit hard to see okay well anyway hopefully it's going well and let's check that by using this direction to pick the color underneath which is these colors here coming from this grid okay so using these Bend Direction you're going to calculate the intersected point from each lens point pick the color of course pick the corresponding color using the intersected information okay so let's do that now I have the bend Direction you could calculate the intersection in order to use the intersections you need to have an intersected Point positions primitive UV and into a section can be calculated by intersect intersect to the second input which is the grid image and intersect from the current starting array from the current Point position of the lens then to the bent Direction with enough amount to Trace get the intersected position and UV as an output and what you want to get is the color informations at the intersected Point position so you could use this pruv together with the enter to get to retrieve the image color the color informations so if enter section is available then the color information is gram UV second input get the color and actually I realized that um I am looking at the Primitive colors so you I can just use Prim width and enter I don't really need to use a UV in this case because the color is applied to each primitive as an attribute all right so does it make any change not yet somehow let me try to reset this just to make sure hmm okay and where does the code go okay ah the code is gone for some reasons gotta rewrite this again oh where was I so enter this happens a lot for me code just disappears I don't know why intersect second input e starting from the current Point positions bent Direction multiplied by 1000 interpositions and UV White something is off here it's been disappeared again hmm let me reopen the file save it override let's try let's let me rewrite this again I don't know why it disappears e so Vector into position prab intersect intersect second input starting from the current Point position bent Direction multiply by 1000 intersection positions VR UV how's this oh wow just disappears why is that I have no idea how's this uh [Music] am I doing something wrong here I am not sure let me copy this create on a point wrangle paste it here okay that's gonna re try to re-create the same situations here Vector interpositions b r u v okay now this seems to work not sure why it didn't work last time and I I guess I need to copy these values here as well that might have been the reason Maybe I don't know because of the camera positions Maybe I don't know let's try going back to the camera again copy the Translate paste it here write something okay it doesn't disappear so maybe that's not the case well intersection intersect second input um starting from at p and Direction multiplied by 1000 intersecting positions p r u v oh hmm why let me try deleting the camera positions huh this is so weird okay I have no idea what's going on and intersect okay in this case I'm just going to use the external editor so yeah this should work because I have this apply button enter is equal to intersect one position Bend okay this is like fifth times I'm writing the same code PR UV okay apply cool now let's get the color is intersection is available then change the color to the Primitive color at enter selected primitive number else I could just set it to Black I guess there you go okay now it already should have the effect of the refraction by changing the camera view you see that things are happening the images happening the chain started to change based on the camera angle all right and by changing those parameters like the number of lands or the height of the lens you could see how it make a difference this is the resolutions on the vertical Direction this is the the roundness of the lens so if you have small roundness you're seeing more gradual differences between the image if you have high lens height you see more crisp sprit between the image interesting and if you have more lens numbers starting to have more gradual liquidation So based on those numbers you might need to change those parameters to corresponding value to have the right amount the lens aroundness or the height height also changes how it views cool and by changing the number of images from three to more numbers should be able to have more gradual animated View now in this case I might need to change the height a little bit more or the lens height as well a little bit higher in this case to have more crisp image it's you need to find some good balance in order to give you know to have the smooth animated effect so I think this is practically used for in order to find out the best parameter for the physical object as well because this small amount of value would change drastically change how it looks like so probably if if if you can fabricate the real lens precisely than this value this simulations could be useful just as a dream maybe in the future it might be possible well at least this is interesting seeing all these different effect by just changing the height of the lens and the depths isn't it you could also see some kind of a moire effect maybe I need to change height and why it View all right looks more like it Okay so this is how kind of a lengthy killer effect works let me know if you have any questions or anything and probably you could just change this rubber toy to something different like pig head get the similar effect like that in this case you might need more offset or a margins to fit in the grid and I could also coordinate the parameters a little bit so that I have more crisp image per angle it's pretty hard really hard to find the right balance but totally worth it pretty interesting really looks like in a real rendicular effect isn't it um is there any way we can see your own Creations well I am doing a self work together with an artist graphic designer called as D graph so if you could check the work there you could check the work here on the graph here this is a design studio by Afghanistan you're a mass of caution graphic designer and me as a algorithmic designer we're doing some digital design work applied for a physical design like a plotter drawings this is one of the examples we did using plotter design to draw an algae algorithmically created images like nature inspired shape for these we also tried use creating pot inspired by the boxels and so on so please check it out if you're interested in this kind of stuff okay well I guess and this is it for today let me know if you have any questions or feedbacks I could also try um if you're interested I could also try it using like curved slit or lens for trial which I haven't tried previously currently this is more physical based vertical lens which is already available commercially but the curved lens might not be part might not be available in the physical situations but you could do the simulations in the virtual space so it might be interesting testing out testing these out as well so let me know if you're interested if not I'll just finish this live here meanwhile I am going to uh organize this a lot of it okay let's call this shape parameter copy this one here what else I think I have already transferred all the parameters so I guess this is it I think I I'm not seeing any comments anymore so let's just finish it here shall we well thank you for joining and I'll see you next week sometime all right let me just try to find out find out some nice parameter for the final screenshot okay well as always I am going to upload the file to the GitHub I am going to paste the file URL to the video description page of this video live stream that you can download it and together with an archive and and I'm also doing the patreon page myself so if you are with are interested in this kind of stuff if you would like to support me I'll be really appreciate it Okay so that's it thank you very much for coming hopefully you are having a nice day nice weekend all right okay so good night and see you next week bye bye hmm
Info
Channel: Junichiro Horikawa
Views: 7,928
Rating: undefined out of 5
Keywords: houdini, sidefx, live, tutorial, procedural, procedural modeling, parametric modeling, parametric design, parametric, fabrication, digital design, computational design, 3d, design, isosurface, lattice, structure, 3d modeling, modeling, computational, generative, line drawing, drawing, illustration, fractal, reaction diffusion, celullar automata, simulation, trail, particle, vfx, mitosis, volume, rendering, computer graphics, visualization, algorithm, motion graphics, graphics, remesh, quad, flower, plant
Id: sAI4PgIsAyU
Channel Id: undefined
Length: 105min 58sec (6358 seconds)
Published: Sat Aug 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.