Switch texture water to lava

Home Forums AR Sandbox Forum Switch texture water to lava

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
  • #2362
    Nicolas Mendoza

    I have been trying to add the scripts to switch textures from water to lava, etc, that users @mkaszuba, @ajy00 and others posted at the old forum:
    @mkaszuba solution at the end of the posts
    usb button solution

    I made this work in 2018, I’m trying again with a new sandbox, but I’m running into errors. Here are the instructions in case anyone can make it work.

    Hi Gang. After much effort, trying to get software to work as desired, I will attempt to describe my completed “post installation” steps that I went through. I have used various tips and tricks from other users here. I will try to note them as I go. Please note, I am assumig that you have completed the steps from the Complete Setup guide found here. So this means you are using Vrui 4.2-006, Sandbox 3.2 and kinect 3.2 software, and it turns on and works accordingly. My computer setup is an Alienware Alpha (excellent form factor, with a core i5 CPU, Nvidia m970 video card (yes that works well enough) and 8 gigs of ram)

    The things I have done are:

    Setup the two Application Configuration files noted above in this post. (this is where you hardcode buttons or keyboard keys to run scripts and functions) I used keyboard keys at this time. Button instructions are available here
    keys 1 and 2 are global flood and drain
    keys 3 and 4 are local flood and drain (wherever the pointer is)
    key 5 is a screen capture tool (thanks Peggy) it does require you to install a new package on your linux called “scrot”
    Key 6 is the “change weather” or “change substance” tool (thanks ajy00)
    Created a ~/src/ScreenShots folder to receive the scrot images (when the 5 key is pressed)
    Created a ~/src/scripts folder to place the various scripts (thanks again to Peggy)
    Collected many shader files for changing the colour of the “rain”/weather even though I only use 4 (thanks to INTPTT and Oliver mostly)
    Here is a image of what is contained in my zip file.
    Contents of the zip file : LINK FILE TEXTURES
    After completing the Complete installation guide, and the Post installation follow up:

    Download the zip file above
    From the zip file, Copy the two .cfg files (from the dot-config/Vrui-4.2/Applications folder in your .config/Vrui-4.2/Applications folder (note: the .config folder is hidden in your home folder. You may need to turn on “show hidden files” if you are using “file explorer” on the desktop
    In your src folder, create a new folder called ScreenShots<\li>
    In your src folder, copy the scripts folder from the zip file<\li>
    copy the contents of the shaders folder from the zip file to the `/src/SARndbox-2.3/share/SARndbox-2.3/shaders folder<\li>
    Possible issues with trying things out.
    <li>run each script from the terminal to make sure it works.<\li>
    <li>edit the scripts to reflect your folder structure. The script files will allow a relative folder reference such as “`/src” but the .cfg files will not<\li>

    Edit the SARndbox.cfg file to reflect your folder structure. Where you see “/home/sandbox/…” replace sandbox with your username on you system.<\li>
    Check the spelling of your code! I can not tell you how many times I had to reboot my machine just because I missed an “s” for an “S” LinuxMint uses is a case sensitive file system<\li>
    If all works out when you run your sandbox software, keys 1-6 should do something. If you come across a key which presents the interactive menu from the sandbox software then something went wrong with the assignment of the keys.


    “Just to reiterate, the folder structure is vital, and spelling is also vital. Folder locations I used/modified are:

    /home/sandbox/.config/Vrui-4.2/Applications for the two cfg files as noted above in this thread
    /home/sandbox/src/SARndbox-3.2/share/SARndbox-2.3/shaders for the shader files.
    /home/sandbox/src/ScreenShots to receive the screen capture files.<\li>
    /home/sandbox/src/scripts to place all the script files.<\li>
    /home/sandbox/src/Vrui-4.2-006/Vrui/Tools for the extra two code files to allow scripting.
    After you copy the two code files to the tools folder, you must “remake” the vrui app to include the new two new code files.”

    Here ends @mkaszuba instructions.
    So I:
    -Copied the files in the correct folders
    -Changed the texts of the scripts from SARndbox-2.3 to SARndbox-2.8.
    -Make install Changing the text of the vrui version for the 2 new scripts on the tool folder.
    -Modified the SARndbox.cfg on the hidden .config folder as in the files of @mkaszuba drive, changed username on executablePathName for the switch script.
    So now I can use local water on keys 3 and 4 thanks to the bindings but when I press 6 to switch texture sandbox freezes, and it shows this error on the console:

    [xcb] Unknown sequence number while processing queue
    [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
    [xcb] Aborting, sorry about that.
    SARndbox: ../../src/xcb_io.c:259: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost’ failed.
    Aborted (core dumped)

    I reviewed the process many times, but can’t find a solution.

    This is my SARndbox.cfg inside .config/Vrui-8.x/Applications if anyone needs it.

    Sorry for the long post,

    Sean Robinson

    First, the caveat: I have not used these scripts. But, everything looks generally reasonable.

    With the sandbox running, what happens when you run /home/civur/src/scripts/weather.sh from a terminal window?

    Do you have a “~/src/scripts/weather_file.tmp” file that contains one of rain, lava, waste, or snow? The weather.sh script looks inside this file to determine which shader to use for colors.

    Nicolas Mendoza

    Hi sean when i run that command i get this error on the other terminal

    civur@civur-H410M-H-V3:~$ /home/civur/src/scripts/weather.sh
    bash: /home/civur/src/scripts/weather.sh: Permission denied

    My /src/scripts/weather_file.tmp file only has the word rain

    Sean Robinson

    Thank you for providing the error message. I think the solution is as simple as running the following in a terminal window: chmod u+x /home/civur/src/scripts/weather.sh.

    Files must be marked as executable before bash will run them from the command line. The above command makes the weather script able to be run by the civur user.

    The “switch-to-snow.sh” (and similar) scripts should be okay with how thay are executed in weather.sh. But, if you see more “Permission denied” error, try changing the permission on the “switch” scripts, too.

    Let us know if this works. If it does, the River Wey Trust may want to include permission changes in their script documentation.

    Nicolas Mendoza

    Damn Sean you are a genius haha, that was the problem, thanks for enlightening those less skilled in linux, also thanks for replying so fast!

    People that want to uso buttons to flood/dry and switch texture can use this post to work it out, my cfg is at upper part of the post if anyone want to use it.

    I did look at the solution from river wey trust i think this one is based on that or is the same at some point, but I did not see at Github the cfg with the script part calling for weather switch for a button, so it was not simple to figure it out. anyway there are many things that i will try from river wey trust.

    Thanks again!


    This information was very helpful! I was able to pull the files and use the process that @Nicolas Mendoza posted, as well as apply the chmod fix that Sean posted – and the lava texture works! Thank you both!

    Now another question: When the textures change the shaders stay the same however. How would I set it up to change the shaders to match the textures? I tried poking around for a while and could not see where the breakdown is.

    Sean Robinson

    @Cormac Congratulations on changing the texture. Another sandbox gets enhanced!

    When the textures change the shaders stay the same however.

    I apologize, but I don’t understand what you mean. Could you give a concrete example?


    Sorry – I’ll try to explain better. I am by no means an expert with this stuff – so I often lack the terminology! In the process of making the changes, I dropped new shaders into /src/SARndbox-2.3/share/SARndbox-2.3/Shaders. An example is SurfaceAddWaterColor-Lava.fs – My thought was that this would change the “water” color from blue to red when animating lava. Currently I have lava animating over the blue water shader for below sea level.

    Am I correct in thinking there is a way to make these adjustments as we cycle through the animations?

    I appreciate the help tremendously – this sub has been very helpful!

    Sean Robinson

    I think the “water” (in lava mode) you are calling a “shader” is part of the “color map” in the sandbox software, it describes the sand elevation using different colors. The default color map is blue below sea level and a rainbow of colors above sea level.

    You can tell the running sandbox to use a new color map file:

    1) If not already done, add a control pipe in the folder you launch SARndbox. In a terminal window, run mknod SARndbox.pipe p to create a pipe you will use to control the running sandbox.

    2) If not already done, tell SARndbox to use a control pipe. This is done with the -cp SARndbox.pipe option. I.e. “SARndbox -uhm” becomes “SARndbox -uhm -cp SARndbox.pipe”. The pipe names must match in steps 1 and 2.

    3) Create an alternate color map file. Find “HeightColorMap.cpt” and copy it, in the same folder, to “HeightColorMap-lava.cpt”. The four columns in cpt files are (left to right) elevation, red, green, and blue. Edit “HeightColorMap-lava.cpt” to swap the red and blue values for all elevations below sea level. For example, the first line (“-40.0 0 0 80”) becomes “-40.0 80 0 0”.

    4) Test your new color map in a terminal window. Run echo "colorMap HeightColorMap-lava.cpt" > SARndbox.fifo to change to the lava color map. Run echo "colorMap HeightColorMap.cpt" > SARndbox.fifo to change to the default color map.

    5) Add echo "colorMap <color map file>" > SARndbox.fifo to the “switch” scripts to match the color map to the texture.

    6) Ask questions if you run into problems.


    These instructions are super helpful! So thank you for posting a good explanation. I am having a strange issue though. I can send the command to the pipe and it does change the elevation map colors but only after I restart the program. I’m not getting any errors in the command line where SARndbox is running. I’ve tried creating a pipe file with both mknod and mkfifo but neither will cause the program to update in realtime. Any help is very appreciated!

    Sean Robinson

    I’m glad you found it useful.

    Please post the output of ls -l SARndbox.fifo (or your pipe name) from the directory containing the pipe.

    I’m expecting it to look similar to prw-r--r-- 1 sean users 0 Jun 8 11:58 SARndbox.fifo.

    And please post the command you use to start the sandbox.

    I’d like to see the ordering of arguments you are using; something like SARndbox -uhm -fpv -cp SARndbox.fifo.


    ok here is what I got for permissions -rwxrwxrwx 1 sandbox sandbox 28 Jun 7 13:05 SARndbox.fifo

    and here is the command I was using straight out of the /bin folder in terminal

    ./SARndbox -fpv -uhm -cp ~/src/SARndbox-2.8/bin/SARndbox.fifo -vruiVerbose

    • This reply was modified 10 months, 2 weeks ago by robbo.
    Sean Robinson

    Thank you, I believe I see the issue. Your “SARndbox.fifo” is a regular file, not a pipe. To fix this, remove the existing file before creating a new pipe with the same name.

    The “p” as the first character of my output (versus “-” in your output) says the file is a pipe. You can confirm you have correctly recreated the pipe with ls -l SARndbox.fifo and look for the leading “p”.

    Your SARndbox command looks good to me.


    OK! I think I figured out why I was running into issues. I recreated the SARndbox.pipe file in the /bin directory with mknod SARndbox.pipe p.

    If you do it this way it does not create a SARndbox.fifo named pipe file. So if I try to reference it with SARndbox -uhm -fpv -cp SARndbox.fifo or send it commands like echo "colorMap <color map file>" > SARndbox.fifo it doesn’t work.

    So the solution is very simple 🙂 I changed any reference toSARndbox.fifo to SARndbox.pipe and voila! Everything works great! I can update the color maps with a simple script just how you outlined above in real time.


    Hey guys, I Just finish Reading the post, and im facing some troubles, I did the same things as Nicolas Mendonza, but when I execute home/civur/src/scripts/weather.sha I got a “No such file or directory”. Im using the same config as Nicolas. Also, when I press the “5” button, it closes the sandbox aplication, the same with the “6” button, the aplication freeze and then close.

Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.