티스토리 뷰

728x90
반응형

오늘의 튜토리얼 :

https://youtu.be/fBA3Fw07MAM

 

시작.

[obj 안에서]

geo 생성

[geo 안에서]

box생성

attribute create 생성 : 점 컨트롤을 위해서 ?

 

: 가로 세로 1 값으로 지정해주고 시작하면 좋을듯

+ for each number 생성 : 피드백 루프를 위해 생성하는 듯

foreach end1 설정

feedback Each Interaction

foreach begin1 설정

파란 글자 주목 : method

일단 루프 안하니까 foreach end 에서

iterations : 반복

 

+ Primitive Wrangle 생성

이름변경 : 

\

\

인스펙터창 ..

geo spreadsheet
도형 클릭

그냥확인용인가봐..

다시 원래 파라미터 창으로 돌아가 ..

코드 만들자 

int ite = detail(1, "iteration");
float seed = chf("seed");

저기 슬라이드 아이콘 누르면 컨트롤 채널이 생긴다.

범위range 를 바꿔준다.

+ 코드 추가

//repeat number
int ite = detail(1, "iteration");
//seed -> add channel 
float seed = chf("seed");

//bring size attribute 
vector psize = v@size;

 

다음을  ?? 박스의 점에 할당된 숫자를 알아보자.

 

+ sort  추가 

size와 foreach 사이에

점의 순서를 정해주는 건가봐

But !! 다지웠음 ..

코드 추가

//repeat number
int ite = detail(1, "iteration");
//seed -> add channel 
float seed = chf("seed");

//bring size attribute 
vector psize = v@size;
//box's vertices
int vertices[] = primvertices(0,@primnum);
//save four point
int pt1 = vertexpoint(0, vertices[0]);
int pt2 = vertexpoint(0, vertices[1]);
int pt3 = vertexpoint(0, vertices[2]);
int pt4 = vertexpoint(0, vertices[3]);

//retrieve each point position
vector pos1 = point(0, "P", pt1);
vector pos2 = point(0, "P", pt2);
vector pos3 = point(0, "P", pt3);
vector pos4 = point(0, "P", pt4);

//create two vector (x,y)
vector dirx = pos2 - pos1;
vector diry = pos4 - pos1;

//normalize dir
vector ndirx = normalize(dirx);
vector ndiry = normalize(diry);

//to get size (distance)
float sizex = distance(pos1, pos2);
float sizey = distance (pos1, pos4);

//divide this durface into two dicide n=1 create fist primitive, n=2 create another
for(int n=0; n<2; n++){
    //random value : perlin noise value //ite : repeat num.. each frame : time val
    //4th speed to make it as a periodic period
    int speed = chi("speed");
    float noiseval = pnoise(ite*624.24+@primnum*834.42 + speed, @Frame / float($FEND), 0, speed);

    //determine which edge divide
    if(psize.x > psize.y) {
    //dividing x direction
        //multiply noise val : x = new x size
        float mx = sizex * noiseval;
        
        //make small sq primitive
        int npt1 = addpoint(0, pos1 + ndirx *mx *n); // n= 1 repeat
        int npt2 = addpoint(0, pos1 + ndirx* (sizex + (n-1) * (sizex - mx)));
        int npt3 = addpoint(0, pos1 + ndirx* (sizex + (n-1) * (sizex - mx)) + diry);
        int npt4 = addpoint(0, pos1 + ndirx *mx *n + diry);
        
        int prim = addprim(0, "poly", npt1,npt2,npt3,npt4);
        
        //update primitive size 
        setprimattrib(0, "size", prim, set(psize.x * 0.5, psize.y));
    }else {
        //multiply noise val : y = new y size
        float my = sizey * noiseval;
                
        //make small sq primitive
        int npt1 = addpoint(0, pos1 + ndiry *my *n); // n= 1 repeat
        int npt2 = addpoint(0, pos1 + dirx + ndiry *my *n);
        int npt3 = addpoint(0, pos1 + dirx + ndiry * (sizey + (n-1) * (sizey - my)));
        int npt4 = addpoint(0, pos1 + ndiry * (sizey + (n-1) * (sizey - my)));
        
        int prim = addprim(0, "poly", npt1,npt2,npt3,npt4);
                //update primitive size 
        setprimattrib(0, "size", prim, set(psize.x, psize.y * 0.5));
    }
}
//remove frame num primnum
removeprim(0, @primnum, 1);

여기서 프리미티브 0 은 한 면을 만한다. delete로 확인해 보면 시계방향이라는데 이게 어떻게 시계방향이냐.. 일단 ㄱ 

retrive

된다 !!

 

728x90
반응형
250x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/03   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
글 보관함
반응형