Fri, Apr 19, 2:02 AM CDT

Welcome to the Poser 12 Forum

Forum Moderators: nerd, donnena Forum Coordinators: nerd

Poser 12 F.A.Q (Last Updated: 2024 Apr 18 2:45 am)



Welcome to the Poser Forums! Need help with these versions, advice on upgrading? Etc...you've arrived at the right place!


Looking for Poser Tutorials? Find those HERE



Subject: Rotation when using an HDR bitmap on the background node


Y-Phil ( ) posted Sun, 02 May 2021 at 3:17 PM · edited Wed, 03 April 2024 at 4:20 PM

Hi all

If you are like me, often using an HDR bitmap on the background, there is a moment when we have to find the right angle. Even though it is as esay as click, move the cursor, enter the valeur, enter and wait till Poser has finished to update, and make a fast test-render, here is a little script I have written to ease that part, and it works also in the "Pose" room:

import poser

def set_background_angle(angle):
  bk_shader = poser.Scene().BackgroundShaderTree()

  for node in bk_shader.Nodes():
    if node.Type() == 'ccl_Mapping':
        node.InputByInternalName('Rotation').SetColor(0.0,angle,0.0)

  bk_shader.UpdatePreview()


val = poser.DialogSimple.AskFloat("Enter the Vertical Rotation (rad)")
if val != None:
    set_background_angle(val)

Just as a reminder, here is the setup I have saved in my runtime library:

2021-05-02_22h15_00.png

The longuest part to write this script: well... to guess that I had to define the rotation values by setting the Mapping node's Rotation "Color"... lol

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


Miss B ( ) posted Sun, 02 May 2021 at 5:55 PM

I'm not using P12 a lot as yet, but I've bookmarked this for future reference, as I like using HDRi backgrounds with SuperFly, though I most often use Snarly's EZDome. it's still good to be able to do it with the background node, especially since Snarly's not finished updating his goodies as yet.

_______________

OK . . . Where's my chocolate?

Butterfly Dezignz


hborre ( ) posted Sun, 02 May 2021 at 9:11 PM

Would it be possible to engage the x- and z- rotations in the script? It might not be practical for everyone but it would be interesting to have additional options.


ghostship2 ( ) posted Sun, 02 May 2021 at 10:48 PM

I think a value of 6 rotates the sphere 1 full rotation

W10, Ryzen 5 1600x, 16Gb,RTX2060Super+GTX980, PP11, 11.3.740


Y-Phil ( ) posted Mon, 03 May 2021 at 1:22 AM · edited Mon, 03 May 2021 at 1:23 AM

In fact, to be precise: 6.28 = 2x pi, the well-know value: 3.1416, 3.141592, etc.. . The values I remember are 1.57, 3.16, 4.7, nearly a quarter turn each time, and... 2.2 ?.... I don't know why but using this value, I have often stumbled upon a nice-looking situation with hdrihaven's bitmaps... The units are the radians, with the 0 on your right (counter-clockwise), but you may as well enter a negative value: -1.57 corresponds to 4.7.

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


Y-Phil ( ) posted Mon, 03 May 2021 at 1:27 AM

hborre posted at 1:26AM Mon, 03 May 2021 - #4418236

Would it be possible to engage the x- and z- rotations in the script? It might not be practical for everyone but it would be interesting to have additional options.

Currently, I'm at my job. But when it's finished, I'll make an update ?

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


Y-Phil ( ) posted Mon, 03 May 2021 at 6:18 AM

Small update: this version displays the current value:

def set_background_angle(angle):
  bk_shader = poser.Scene().BackgroundShaderTree()

  for node in bk_shader.Nodes():
    if node.Type() == 'ccl_Mapping':
          node.InputByInternalName('Rotation').SetColor(0.0, angle, 0.0)

  bk_shader.UpdatePreview()
  
def get_background_angle():
  bk_shader = poser.Scene().BackgroundShaderTree()
  node = [n for n in bk_shader.Nodes() if n.Type() == 'ccl_Mapping']
  if not node:
    return None

  values = node[0].InputByInternalName('Rotation').Value()
  return values[1] if isinstance(values, tuple) else None

    
msg = "Enter the Vertical Rotation (rad)"
curr_val = get_background_angle()
if curr_val:
    msg = "{}nActually: {}".format(msg, curr_val)

val = poser.DialogSimple.AskFloat(msg)
if val != None:
    set_background_angle(val)

Actually, the Poser function asks for a float. To be able to respond to hborre's query, I will search, at the end of may day job, for a function that let us enter a string of characters, instead... ?

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


hborre ( ) posted Mon, 03 May 2021 at 9:18 AM

Take your time, there is no rush. And thank you enough for your generosity.


adp001 ( ) posted Sat, 08 May 2021 at 9:58 AM

I made a script to create a background HDR setup and a Grouping Object to manipulate the intensity, and XYZ-Rotation.

https://www.renderosity.com/rr/mod/forumpro?thread_id=2961233




adp001 ( ) posted Sat, 08 May 2021 at 1:42 PM

Don't forget to set set Scale to -1, 1, 1 if you don*t want text mirror-inverted.




Y-Phil ( ) posted Thu, 13 May 2021 at 10:55 AM · edited Thu, 13 May 2021 at 10:55 AM

hborre posted at 10:54AM Thu, 13 May 2021 - #4418236

Would it be possible to engage the x- and z- rotations in the script? It might not be practical for everyone but it would be interesting to have additional options.

Here you are: an updated version of the script that lets you enter either the vertical rotation or tuple (x,y,z) of values:

def ask_for_a_string(question):
    ''' 
        Let's enter a string. 
        Note that for numerical values, there is a dedicated function
    '''
    dialog = poser.Dialog()
    txt_dlg = poser.DialogTextEntry(dialog, question)
    return None if not txt_dlg.Show() else txt_dlg.Text()

def set_background_angle(x, y, z):
    bk_shader = poser.Scene().BackgroundShaderTree()

    for node in bk_shader.Nodes():
        if node.Type() == 'ccl_Mapping':
            node.InputByInternalName('Rotation').SetColor(x, y, z)

    bk_shader.UpdatePreview()
  
def get_background_angle():
    bk_shader = poser.Scene().BackgroundShaderTree()
    node = [n for n in bk_shader.Nodes() if n.Type() == 'ccl_Mapping']
    if not node:
        return None, None, None

    return node[0].InputByInternalName('Rotation').Value()
    
msg = "Enter either the Vertical Rotation or x,y,z (rad)"
x,y,z = get_background_angle()
if x != None:
    msg = "{}nActually: {:.5f},{:.5f},{:.5f}".format(msg, x,y,z)

val = ask_for_a_string(msg)
if val != None:
    check = val.split(',')
    if len(check) == 3:
        x, y, z = eval(val)
    else:
        y = float(val)
    set_background_angle(x, y, z)

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


hborre ( ) posted Thu, 13 May 2021 at 5:12 PM

Oh cool. Thank you very much. I look forward to playing around with this.


Y-Phil ( ) posted Thu, 13 May 2021 at 5:53 PM

hborre posted at 5:51PM Thu, 13 May 2021 - #4419113

Oh cool. Thank you very much. I look forward to playing around with this.

It works the Python way: 1 or 1,2,3 or (1,2,3), as you want ?

PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.