Re: [Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-19 Thread Mark Nettleton

Thanks Ivan! That does work. Pixel perfect.


Ivan Busquets wrote:
I'm not sure that Posterize would give the desired result in this 
case, since it will still throw values that are not possible to 
represent as a half precision float.


You'd probably want to re-create a 16 bit half-float value by breaking 
the 32 bit float into its exponent and mantissa(significant) values, 
and then truncating those.


The following expression might work (not thoroughly tested, though)

set cut_paste_input [stack 0]
version 7.0 v4
push $cut_paste_input
add_layer {alpha alpha.red alpha.beta}
Expression {
 expr0 "exponent(r) > 16 ? r*inf: ldexp(rint(mantissa(r)* 
(2**11))/(2**11),  exponent(r))"
 expr1 "exponent(g) > 16 ? g*inf: ldexp(rint(mantissa(g)* 
(2**11))/(2**11),  exponent(g))"
 expr2 "exponent(b) > 16 ? b*inf: ldexp(rint(mantissa(b)* 
(2**11))/(2**11),  exponent(b))"

 channel3 alpha
 name Float_To_Half
 selected true
 xpos 292
 ypos 226
}

Hope that helps.

PS. Mark, hope you're doing well! :)




On Sun, Feb 17, 2013 at 5:35 AM, Shailendra Pandey > wrote:


well actually 281474976710656 -1
281474976710655
Hope that helps



On Sun, Feb 17, 2013 at 9:25 PM, Shailendra Pandey
mailto:shail...@gmail.com>> wrote:

Hi Mark

You can use a posterize node
with a value of 281474976710656
which is 2 to the power(16*3)



Cheers
Shail

On Sun, Feb 17, 2013 at 6:25 AM, Mark Nettleton
mailto:mnettle...@ilm.com>> wrote:

I'm generating an ST map within Nuke, that needs to line
up with 16 bit half float ST map images on disk.

Is there a way I can generate 16bit half float values
within nuke? Or convert 32 bit values to 16 bit half?
(without writing to disk and reading back)

Thanks

___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users




___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk
,
http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users




___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Re: [Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-17 Thread Shailendra Pandey
Good Stuff!
thanks for that Ivan :D

On Mon, Feb 18, 2013 at 1:04 PM, Michael Garrett wrote:

> add_layer {alpha alpha.red alpha.beta}
>
> nice
>
>
> On 17 February 2013 13:55, Ivan Busquets  wrote:
>
>> I'm not sure that Posterize would give the desired result in this case,
>> since it will still throw values that are not possible to represent as a
>> half precision float.
>>
>> You'd probably want to re-create a 16 bit half-float value by breaking
>> the 32 bit float into its exponent and mantissa(significant) values, and
>> then truncating those.
>>
>> The following expression might work (not thoroughly tested, though)
>>
>> set cut_paste_input [stack 0]
>> version 7.0 v4
>> push $cut_paste_input
>> add_layer {alpha alpha.red alpha.beta}
>> Expression {
>>  expr0 "exponent(r) > 16 ? r*inf: ldexp(rint(mantissa(r)*
>> (2**11))/(2**11),  exponent(r))"
>>  expr1 "exponent(g) > 16 ? g*inf: ldexp(rint(mantissa(g)*
>> (2**11))/(2**11),  exponent(g))"
>>  expr2 "exponent(b) > 16 ? b*inf: ldexp(rint(mantissa(b)*
>> (2**11))/(2**11),  exponent(b))"
>>  channel3 alpha
>>  name Float_To_Half
>>  selected true
>>  xpos 292
>>  ypos 226
>> }
>>
>> Hope that helps.
>>
>> PS. Mark, hope you're doing well! :)
>>
>>
>>
>>
>> On Sun, Feb 17, 2013 at 5:35 AM, Shailendra Pandey wrote:
>>
>>> well actually 281474976710656 -1
>>> 281474976710655
>>> Hope that helps
>>>
>>>
>>>
>>> On Sun, Feb 17, 2013 at 9:25 PM, Shailendra Pandey 
>>> wrote:
>>>
 Hi Mark

 You can use a posterize node
 with a value of 281474976710656
 which is 2 to the power(16*3)



 Cheers
 Shail

 On Sun, Feb 17, 2013 at 6:25 AM, Mark Nettleton wrote:

> **
> I'm generating an ST map within Nuke, that needs to line up with 16
> bit half float ST map images on disk.
>
> Is there a way I can generate 16bit half float values within nuke? Or
> convert 32 bit values to 16 bit half? (without writing to disk and reading
> back)
>
> Thanks
>
> ___
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>


>>>
>>> ___
>>> Nuke-users mailing list
>>> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>>
>>
>>
>> ___
>> Nuke-users mailing list
>> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>
>
>
> ___
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Re: [Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-17 Thread Michael Garrett
add_layer {alpha alpha.red alpha.beta}

nice


On 17 February 2013 13:55, Ivan Busquets  wrote:

> I'm not sure that Posterize would give the desired result in this case,
> since it will still throw values that are not possible to represent as a
> half precision float.
>
> You'd probably want to re-create a 16 bit half-float value by breaking the
> 32 bit float into its exponent and mantissa(significant) values, and then
> truncating those.
>
> The following expression might work (not thoroughly tested, though)
>
> set cut_paste_input [stack 0]
> version 7.0 v4
> push $cut_paste_input
> add_layer {alpha alpha.red alpha.beta}
> Expression {
>  expr0 "exponent(r) > 16 ? r*inf: ldexp(rint(mantissa(r)*
> (2**11))/(2**11),  exponent(r))"
>  expr1 "exponent(g) > 16 ? g*inf: ldexp(rint(mantissa(g)*
> (2**11))/(2**11),  exponent(g))"
>  expr2 "exponent(b) > 16 ? b*inf: ldexp(rint(mantissa(b)*
> (2**11))/(2**11),  exponent(b))"
>  channel3 alpha
>  name Float_To_Half
>  selected true
>  xpos 292
>  ypos 226
> }
>
> Hope that helps.
>
> PS. Mark, hope you're doing well! :)
>
>
>
>
> On Sun, Feb 17, 2013 at 5:35 AM, Shailendra Pandey wrote:
>
>> well actually 281474976710656 -1
>> 281474976710655
>> Hope that helps
>>
>>
>>
>> On Sun, Feb 17, 2013 at 9:25 PM, Shailendra Pandey wrote:
>>
>>> Hi Mark
>>>
>>> You can use a posterize node
>>> with a value of 281474976710656
>>> which is 2 to the power(16*3)
>>>
>>>
>>>
>>> Cheers
>>> Shail
>>>
>>> On Sun, Feb 17, 2013 at 6:25 AM, Mark Nettleton wrote:
>>>
 **
 I'm generating an ST map within Nuke, that needs to line up with 16 bit
 half float ST map images on disk.

 Is there a way I can generate 16bit half float values within nuke? Or
 convert 32 bit values to 16 bit half? (without writing to disk and reading
 back)

 Thanks

 ___
 Nuke-users mailing list
 Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
 http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

>>>
>>>
>>
>> ___
>> Nuke-users mailing list
>> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>
>
>
> ___
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Re: [Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-17 Thread Ivan Busquets
I'm not sure that Posterize would give the desired result in this case,
since it will still throw values that are not possible to represent as a
half precision float.

You'd probably want to re-create a 16 bit half-float value by breaking the
32 bit float into its exponent and mantissa(significant) values, and then
truncating those.

The following expression might work (not thoroughly tested, though)

set cut_paste_input [stack 0]
version 7.0 v4
push $cut_paste_input
add_layer {alpha alpha.red alpha.beta}
Expression {
 expr0 "exponent(r) > 16 ? r*inf: ldexp(rint(mantissa(r)* (2**11))/(2**11),
 exponent(r))"
 expr1 "exponent(g) > 16 ? g*inf: ldexp(rint(mantissa(g)* (2**11))/(2**11),
 exponent(g))"
 expr2 "exponent(b) > 16 ? b*inf: ldexp(rint(mantissa(b)* (2**11))/(2**11),
 exponent(b))"
 channel3 alpha
 name Float_To_Half
 selected true
 xpos 292
 ypos 226
}

Hope that helps.

PS. Mark, hope you're doing well! :)




On Sun, Feb 17, 2013 at 5:35 AM, Shailendra Pandey wrote:

> well actually 281474976710656 -1
> 281474976710655
> Hope that helps
>
>
>
> On Sun, Feb 17, 2013 at 9:25 PM, Shailendra Pandey wrote:
>
>> Hi Mark
>>
>> You can use a posterize node
>> with a value of 281474976710656
>> which is 2 to the power(16*3)
>>
>>
>>
>> Cheers
>> Shail
>>
>> On Sun, Feb 17, 2013 at 6:25 AM, Mark Nettleton wrote:
>>
>>> **
>>> I'm generating an ST map within Nuke, that needs to line up with 16 bit
>>> half float ST map images on disk.
>>>
>>> Is there a way I can generate 16bit half float values within nuke? Or
>>> convert 32 bit values to 16 bit half? (without writing to disk and reading
>>> back)
>>>
>>> Thanks
>>>
>>> ___
>>> Nuke-users mailing list
>>> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>>
>>
>>
>
> ___
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Re: [Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-17 Thread Shailendra Pandey
well actually 281474976710656 -1
281474976710655
Hope that helps


On Sun, Feb 17, 2013 at 9:25 PM, Shailendra Pandey wrote:

> Hi Mark
>
> You can use a posterize node
> with a value of 281474976710656
> which is 2 to the power(16*3)
>
>
>
> Cheers
> Shail
>
> On Sun, Feb 17, 2013 at 6:25 AM, Mark Nettleton wrote:
>
>> **
>> I'm generating an ST map within Nuke, that needs to line up with 16 bit
>> half float ST map images on disk.
>>
>> Is there a way I can generate 16bit half float values within nuke? Or
>> convert 32 bit values to 16 bit half? (without writing to disk and reading
>> back)
>>
>> Thanks
>>
>> ___
>> Nuke-users mailing list
>> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>>
>
>
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

Re: [Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-17 Thread Shailendra Pandey
Hi Mark

You can use a posterize node
with a value of 281474976710656
which is 2 to the power(16*3)



Cheers
Shail

On Sun, Feb 17, 2013 at 6:25 AM, Mark Nettleton  wrote:

> **
> I'm generating an ST map within Nuke, that needs to line up with 16 bit
> half float ST map images on disk.
>
> Is there a way I can generate 16bit half float values within nuke? Or
> convert 32 bit values to 16 bit half? (without writing to disk and reading
> back)
>
> Thanks
>
> ___
> Nuke-users mailing list
> Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users
>
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users

[Nuke-users] 32 bit float -> 16 bit half float expression?

2013-02-16 Thread Mark Nettleton
I'm generating an ST map within Nuke, that needs to line up with 16 bit 
half float ST map images on disk.


Is there a way I can generate 16bit half float values within nuke? Or 
convert 32 bit values to 16 bit half? (without writing to disk and 
reading back)


Thanks
___
Nuke-users mailing list
Nuke-users@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-users