Announcement

Collapse
No announcement yet.

Rhino Toolbar macro to rotate environment map

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rhino Toolbar macro to rotate environment map

    It has been requested to add a button to change the environment map direction via button press.

    Below is a rhino toolbar macro to rotate the vray environment. Feel free to adjust the comments for left/right rotation/prompt.


    Code:
    ! -_RunScript (
    Option Explicit
    'Script copyrighted by Chaos Group USA
    'Moving the uvw_transform of a light slightly without opening texture editor'
    
    Sub RotateTexture(settingUrl, param, dblOffset)
    
    	Dim VRay
    	Dim result
    	Dim rot(3)
    	Dim scale(3)
    	Dim off(3)
    	Dim mir(3)
    
    	Set VRay = Rhino.GetPluginObject("V-Ray for Rhino")
    
    	Dim url
    	
    	VRay.GetSettingsParameterString settingUrl, param, "acolor texture", url
    
    	VRay.GetSettingsParameterString url, "color_a", "acolor texture", url
    
    	VRay.GetSettingsParameterString url, "uvwgen", "plugin", url
    
    	result = VRay.GetSettingsParameterCompTransform(url, "uvw_transform", rot(0), rot(1), rot(2), scale(0), scale(1), scale(2), mir(0), mir(1), mir(2), off(0), off(1), off(2))
    
    	If  result Then
    	
    		If Not IsNull(dblOffset) Then 
    			rot(0) = 0
    			rot(1) = 0
    			off(0) = off(0) + (dblOffset / 360.0)
    			Call VRay.SetSettingsParameterCompTransform(url, "uvw_transform", rot(0), rot(1), rot(2), 1.0, 1.0, 1.0, mir(0), mir(1), mir(2), off(0), off(1), off(2))
    		End If
    	End If
    	
    End Sub
    
    
    Dim dblOffset
    
    dblOffset = 3
    'dblOffset = -3
    '	dblOffset = Rhino.GetReal("Angle to rotate the offset", 45)
    
    RotateTexture "/SettingsEnvironment", "gi_tex", dblOffset
    RotateTexture "/SettingsEnvironment", "bg_tex", dblOffset
    )
    For information on making a rhino toolbar button: http://docs.mcneel.com/rhino/5/help/...enButtonEditor
    Last edited by mnewberg; 11-06-2015, 10:09 AM.
    Best regards,
    Matt Newberg
    Software Developer

    Chaos Group

  • #2
    Not tested yet, but I like the idea. Could it be possible to load the environment to the Rhino environment with the same settings? Than the env turn could be seen at the viewport.

    At the moment the env can be seen at the viewport, if Vray is disabled as renderer and the env editor is be used to set the HDRI as background and than Vray can be enabled again. A long way and it seems to be that Rhino provide all necessary code.
    www.simulacrum.de ... visualization for designer and architects

    Comment


    • #3
      What textures are rotating ? The ones for skylight and reflection/refraction(background) environment vray options tab, right?
      I un-commented the rotate dialog but I accept the default of 45 dg but the texture rotation doesn't seem to change ...

      Click image for larger version

Name:	UVW rotation.jpg
Views:	1
Size:	32.7 KB
ID:	858000


      Could this be done for an hdri loaded in a vray dome light ?
      I hope that vray 3.0 supports viewing of the environment in the viewport ... too much guess work right now
      Last edited by palosanto; 03-08-2015, 11:27 PM.
      www.marinevisuals.com
      3D Visualization for the Marine Industry

      Comment


      • #4
        For this script what we are changing is the offset, which is basically the same as the rotation.

        Comment

        Working...
        X