Francis Bievre

Francis Bievre

About Me

Connect

LOCATION
Not Specified
ウェブサイト

Houdini Engine

Availability

Not Specified

Recent Forum Posts

package from $HIP 2024年1月2日12:20

Hello,

I'm trying to render a scene on a render farm and would like to load a package (sidefxlabs) from the $HIP location.

I can't find any information accessible to someone who sucks at coding but from what I've been able to understand it is not possible ?

I would take any advice about the .json config ... Is it even possible to read a .json from $HIP ? So far no luck.

Thank you.

Francis

Building from patterns convex / concave corners 2023年9月27日5:57

By memory.

Into the place pieces node, you add a specific section designed to determine if a corner is concave or convex. Sides of the buildings are segments, and segments are divided into points. First and last points of a segment are the corners.

You must determine if these points are convex or concave. That will be a point attribute.

The grammar expansion node uses prims to determine where to put corners (in the code already in place). So you convert your point attribute (convex / concave) into a prim attribute and feed that info into the wrangle node (grammar expansion). You then use it to determine what module goes where.

Building from patterns convex / concave corners 2023年5月15日9:46

Hey, I don't remember exactly what I did sorry, but the solution above was not right. It replaced corners alright but didn't take into account the relative sizes of corners. Found a new one, much simpler since then.

If you want to trace my steps, what you need to do is :
- create a concave input (besides the corners input) on the building utility node
- into that node, there is a wrangle node defining variables, add concave variables, same way as corners variables are currently added
- into the building generator > place pieces node, add a tree finding out if a corner is concave or convex, write the answer into a point attribute, then convert it to a primitive attribute
- into the grammar expansion node, which is the node defining which point is what, edit the code to replace corners by concave corners if a segment (i.e prim) has a concave attribute. The segments are read from 1 to XXX so if segment 1 is concave and not segment 0, you know which corners are concave, and which are not. In this case, a few if statements should do the trick.

Here is my current code for that node. Please note that it won't work for you, as it uses variables I created as specified above. You should replace my variables by yours.

+ what I've done so far with the tool : https://www.youtube.com/watch?v=Z6ImSSJe9nQ [www.youtube.com]

float seed = chf("seed");

f@__length = primintrinsic(0, "measuredperimeter", @primnum);

string pattern = chs("pattern");
string CC_L = chs("cc_l");
string CC_R = chs("cc_r");
string CONC_L = chs("cc_l");
string CONC_R = chs("cc_r");

string GetRandomModule(string input; float seed) {
    // Gathering data per module
    int __refpt= findattribval(1, "point", "name", input, 0);
    string _variations[] = point(1, "variations", __refpt);
    float _variationsweights[] = point(1, "weights", __refpt);
    return _variations[sample_discrete(_variationsweights, rand(seed))];

}



if (chi("orientation") == 0) {
        
        s@name = GetRandomModule(s@name, seed * 482824);
        s@conc = GetRandomModule(s@concaveA, seed * 482824);
        int lookup = findattribval(1, "point", "name", s@name, 0);
        i@lookupname = lookup ;
        pattern = point(1, "expanded_form", lookup);
        
        string _corners[] = point(1, "corners", lookup);
        string _concaves[] = point(1, "concave", lookup);
    
        CC_L = _corners[0];
        CC_R = _corners[1];
        

        
        s@CC_R = CC_R ;
        
        
        // ajouter une condition d'appartenance au groupe concave
        CONC_L = _concaves[0];
        CONC_R = _concaves[1];
        
        s@CONC_R = CONC_R ;
        s@CONC_L = CONC_L ;
        
        //Test if previous segement is concave
i@prev_seg = inprimgroup(0, "concavePRIM", @primnum-1);
i@curr_seg = inprimgroup(0, "concavePRIM", @primnum);
i@next_seg = inprimgroup(0, "concavePRIM", @primnum+1);

f@concave_test = @prev_seg + @next_seg + @curr_seg ;

i@replace_L = @concave_test-@next_seg ;
i@replace_R = @concave_test-@prev_seg ;
//f@replace_L = @concave_test ;
         
        
       


    
        
}




s[]@__segments[0] = CC_L;
 // replace module by LEFT CONCAVE
             
               if ( @replace_L == 2) { s[]@__segments[0] = CONC_L ; }

//Test if previous segement is concave
i@prev_seg = inprimgroup(0, "concavePRIM", @primnum-1);
i@curr_seg = inprimgroup(0, "concavePRIM", @primnum);






i[]@__repeatable[0] = 0;
i[]@__corner;

int cornermodulespresent = (CC_L != "" && CC_R != "") ? 1 : 0;
int segmentindex = (cornermodulespresent) ? 1 : 0;
int repeat = 0;
string prevmodule = "";


for (int i = 0; i<len(pattern); i++) {
    string _token = pattern[i];

    if (_token == "<") {
        if (prevmodule != "" && prevmodule != ">")
            segmentindex++;

        repeat = 1;

    } else if (_token == ">") {
        segmentindex++;
        repeat = 0;
        
    } else {
        s@__segments[segmentindex] += _token;
        i@__repeatable[segmentindex] = repeat;
        
    }
    prevmodule = _token;
}

// Expand any expressions
foreach (int _index; string segment; s[]@__segments){
    
    string _segmentstack = "";
    string _segmentsubstack = "";
    prevmodule = "";

    for (int i = 0; i<len(segment); i++) {
        string _token = segment[i];

        if (_token == "[") {
            _segmentstack += _segmentsubstack;
            _segmentsubstack = "";

        } else if (_token == "]") {
            string _nexttoken = segment[clamp(i+1, 0, len(segment))];
            
            
            if (isdigit(_nexttoken) == 1) {
                string _out = "";

                for (int j=0; j < atoi(_nexttoken); j++) 
                    _out += "-"+_segmentsubstack;

                _segmentstack += _out;
                _segmentsubstack = "";

            }

        } else {
            if (prevmodule == "]" && isdigit(_token) == 1 ) {
                
            } else {
                _segmentsubstack += _token;
            }

        }

        prevmodule = _token;
        
    }

    _segmentstack += _segmentsubstack;

    s[]@__segments[_index] = _segmentstack;
}

resize(i[]@__corner, len(s[]@__segments));

if (cornermodulespresent == 1) {
    

// replace module by right corner ir corner module present
    //if (@group_concavePRIM==1) { push(s[]@__segments, CONC_R); }
    
    //if (@group_concavePRIM==0){push(s[]@__segments, CC_R);}
    
    if ( @replace_R != 2) { push(s[]@__segments, CC_R); }
    
    if ( @replace_R == 2) {push(s[]@__segments, CONC_R); }
    
    resize(i[]@__corner, len(s[]@__segments));
    push(i[]@__repeatable, 0);
    i[]@__corner[0] = 1;
    i[]@__corner[-1] = 1;
}