Change font size
It is currently Sat Dec 15, 2018 2:30 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 2   [ 12 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Make a 32m cube terrain sculpt in sim
PostPosted: Sat Aug 20, 2011 7:31 pm 

Joined: Tue Nov 16, 2010 7:45 am
Posts: 9
Its still rough, but felt like posting anyway. Enjoy - Artemis Tesla

{L_CODE}:
integer gSet = FALSE;

string int2hex(integer x)
{
    string hex="0123456789ABCDEF";
    return llGetSubString(hex, (x >> 4), (x >> 4)) +
           llGetSubString(hex, x & 0xF, x & 0xF);
}

default
{
    state_entry()
    {
        llOwnerSay("Script running");
    }
   
    touch_end(integer touched)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            if (!gSet)
            {
                gSet = TRUE;
               
                llOwnerSay("Starting...");
               
                float mapX = 0.0;
                float mapY = 0.0;
                float mapZ = 0.0;
               
                integer x = 0;
                integer y = 0;
                integer z = 0;
               
                string draw = osSetPenSize("", 1);
               
                vector pos = llGetPos();
               
                for (; y < 64; y++)
                {
                    draw = osMovePen(draw, 0, y);
                   
                    for (x = 0; x < 64; x++)
                    {
                        mapX = (float)x/2.0 - 16.0;
                        mapY = (float)y/2.0 - 16.0;
                        mapZ = llGround(<mapX, mapY, 0.0>);
                       
                        if (mapZ > (pos.z + 16.0)) z = 255;
                        else if (mapZ < (pos.z - 16.0)) z = 0;
                             else { z = llRound(((mapZ - (pos.z - 16.0)) * 8.0)); }
                       
                        draw = osSetPenColor(draw, "FF" + int2hex(x * 4) + int2hex(y * 4) + int2hex(z));
                        draw = osDrawLine(draw, x, y, x + 1 , y);
                    }
                }
                osSetDynamicTextureDataBlendFace("", "vector", draw, "width:64,height:64", FALSE, 2, 0, 255, 1);
               
                llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, llGetTexture(1), PRIM_SCULPT_TYPE_PLANE]);

                // Use this when PRIM_SCULPT_FLAG_INVERT is implemented
                // llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, llGetTexture(1), PRIM_SCULPT_TYPE_PLANE | PRIM_SCULPT_FLAG_INVERT]);               
                llOwnerSay("Done.");
            }
        }
    }
}


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Sun Aug 21, 2011 3:16 pm 
OSG Elite
User avatar

Joined: Thu Dec 11, 2008 7:51 am
Posts: 392
Location: England UK
Nice script! :)

As you say its quite rough, but I think it could be a great script once polished. The terrain I tested on has quite hills, and it seems the script only reads +-16m on the z axis which left my hills with the bottom part of the sculpt flat and didn't fit the other sculpts ( I tested this by covering the sim with prims containing this script at 32m intervals). It would be much better, imho, if the script read say, 256m of the terrain on the z axis. Also, I modified the script to automatically resize the prims to <32,32,32> but there was a small gap between the sculpts when pieced together at 32m intervals.

Adelle.

_________________
"Nothing lasts forever; It's scientific"
~David Byrne (Talking Heads)


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Sun Aug 21, 2011 4:12 pm 

Joined: Tue Nov 16, 2010 7:45 am
Posts: 9
Thank you Adelle :)

The +/- elevation limit was to preserve detail, I had the vague idea of stacking cubes.

you can get it to do elevations from 0-255 by changing
{L_CODE}:
                        mapZ = llGround(<mapX, mapY, 0.0>);
                       
                        if (mapZ > (pos.z + 16.0)) z = 255;
                        else if (mapZ < (pos.z - 16.0)) z = 0;
                             else { z = llRound(((mapZ - (pos.z - 16.0)) * 8.0)); }

to
{L_CODE}:
                        z = llRound(llGround(<mapX, mapY, 0.0>));


As to the gap I think I missed something in the area sampling, still looking :)

I took the
{L_CODE}:
[PRIM_SIZE, <32.0, 32.0, 32.0>,
out as I kept having to look underground to invert the prim :)

Oh and a note the textures are currently set to temporary. If it works currently, setting the 2 to a 1 will persist them. http://opensimulator.org/wiki/OsSetDynamicTextureDataBlendFace
{L_CODE}:
osSetDynamicTextureDataBlendFace("", "vector", draw, "width:64,height:64", FALSE, 2, 0, 255, 1);


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Mon Aug 22, 2011 7:28 am 

Joined: Tue Nov 16, 2010 7:45 am
Posts: 9
I know what caused the gap. Still deciding how to fix it.


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Mon Aug 22, 2011 2:48 pm 
OSG Elite
User avatar

Joined: Thu Dec 11, 2008 7:51 am
Posts: 392
Location: England UK
Thanks for the reply Artemis. I got around the prims going underground with the following:

{L_CODE}:
llSetScale(<32,32,32>);
llSetPos(llGetPos() + <0,0,32);


That lifted them up enough to see under them to select and invert. I'll have a play with adjusting the elevation sampling for the terrain and see what effect it has on detail. Not sure what you mean by 'stacking cubes' though.

I also managed to get the textures by the following method, it may be useful:

Create said sculpties but don't apply the texture to the prim; comment out this line:
{L_CODE}:
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SCULPT, llGetTexture(1), PRIM_SCULPT_TYPE_PLANE]);

Using Imprudence viewer simply export the prim to your local computer.
Import the exported prim and the texture will go to your inventory :-)

I can see this having many uses besides just sculpted terrains: Mini models of entire sims, a standard terrain converted to sculptie and resized to cover a 2x2 mega, or just a small sample of terrain that can be applied to the same spot but textured differently to specific areas to enable a variation in terrain textures.

Also, not sure if you know or not, but Nebadon has managed to make some very nice sculpted terrain using L3DT and some command line terrain splitter thingy. I'm not up on the detail about the splitter but I know that Diva has also done some work using it too and tidied up the code a bit, from what I can gather. What state this is in though I have no idea, but some info on it here: http://bit.ly/dKecB1 http://bit.ly/iiW1bM http://bit.ly/dPSrkf http://metaverseink.com/blog/?p=74

I haven't had chance at texturing any of the terrain sculpties yet, so I have no idea on that part... yet :-)

_________________
"Nothing lasts forever; It's scientific"
~David Byrne (Talking Heads)


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Wed Aug 24, 2011 8:00 am 

Joined: Tue Nov 16, 2010 7:45 am
Posts: 9
Its fixed. I shouldn't do math when I'm tired - Artemis

{L_CODE}:
string int2hex(integer x)
{
    string hex="0123456789ABCDEF";
    return llGetSubString(hex, (x >> 4), (x >> 4)) +
           llGetSubString(hex, x & 0xF, x & 0xF);
}

default
{
    state_entry()
    {
        llOwnerSay("Script running");
    }
   
    touch_end(integer touched)
    {
        if (llDetectedKey(0) == llGetOwner())
        {
            llOwnerSay("Starting...");
           
            float mapX = 0.0;
            float mapY = 0.0;
            float mapZ = 0.0;
           
            integer x = 0;
            integer y = 0;
            integer z = 0;

            integer offsetX = 0;
            integer offsetY = 0;
           
            string colorX = "";           
            string colorY = "";           
            string colorZ = "";           
           
            string draw = osSetPenSize("", 1);
           
            vector pos = llGetPos();
               
            for (; y < 64; y++)
            {
                draw = osMovePen(draw, 0, y);
               
                offsetX = 0;
                if (y == 63) offsetY = 1;
                                               
                for (x = 0; x < 64; x++)
                {
                    if (x == 63) offsetX = 1;
                   
                    mapX = ((float)x + offsetX) / 2.0 - 16.0;
                    mapY = ((float)y + offsetY) / 2.0 - 16.0;
                    mapZ = llGround(<mapX, mapY, 0.0>);
                       
                    if (mapZ > (pos.z + 16.0)) z = 255;
                    else if (mapZ < (pos.z - 16.0)) z = 0;
                         else { z = llRound((mapZ - (pos.z - 16.0)) * 8.0); }
                   
                    if (x == 63) colorX = "FF";
                    else colorX = int2hex(x * 4);
                    if (y == 63) colorY = "FF";
                    else colorY = int2hex(y * 4);
                    if (z == 256) colorZ = "FF";
                    else colorZ = int2hex(z);
                   
                    draw = osSetPenColor(draw, "FF" + colorX + colorY + colorZ);
                    draw = osDrawLine(draw, x, y, x + 1, y);
                }
            }
            osSetDynamicTextureDataBlendFace("", "vector", draw, "width:64,height:64", FALSE, 2, 0, 255, 1);
               
            llSetPrimitiveParams([PRIM_SIZE, <32.0, 32.0, 32.0>,
                                  PRIM_TYPE, PRIM_TYPE_SCULPT,
                                  llGetTexture(1),
                                  PRIM_SCULPT_TYPE_PLANE]);

/* Use this when PRIM_SCULPT_FLAG_INVERT is implemented
                llSetPrimitiveParams([PRIM_SIZE, <32.0, 32.0, 32.0>,
                                      PRIM_TYPE, PRIM_TYPE_SCULPT,
                                      llGetTexture(1),
                                      PRIM_SCULPT_TYPE_PLANE | PRIM_SCULPT_FLAG_INVERT]);
*/
            state done;
        }
    }
}

state done
{
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_NONE);
        llOwnerSay("Done.");
        //llRemoveInventory(llGetScriptName());
    }
}


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Fri Jun 08, 2012 12:22 pm 

Joined: Fri Jan 08, 2010 5:38 am
Posts: 33
i just tested it ; now i have 2 invisble sculpties on my regions :twisted: which i can onot remove as ican not see them :ugeek: ; also not with Transaprency .. ! What can i do :?: ; Anybody of you have this thing monitored ? :idea: :arrow:


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Fri Jun 08, 2012 2:50 pm 
Furious Typer

Joined: Thu Nov 03, 2011 2:00 pm
Posts: 95
Wordfromthewise, in the viewer menu at top, click view and choose "Highlight Transparent" in order to see the invisible prims.


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Sat Jun 09, 2012 5:39 am 

Joined: Fri Jan 08, 2010 5:38 am
Posts: 33
Thats what i did. Same as CTRL ALT T .. They are Not Visible and i could Barry move. I deleted them from the database with SQL statements ..


Top
 Profile  
 
 Post subject: Re: Make a 32m cube terrain sculpt in sim
PostPosted: Tue Jan 22, 2013 5:22 am 
Furious Typer
User avatar

Joined: Sat May 26, 2012 8:56 pm
Posts: 280
You could have simply textured the invisible sculpts... also try inverting the sculptmap


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 12 posts ]
Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net