ScriptSpot

Forum topic · General Scripting

Unable to convert: BitMap to type TextureMap

By Any · 2023-12-02

Description

Hi all.
How to convert BitMap to type: TextureMap ?

--------------------------------------------------------------------
displaceBitmapStr = getBitmapOpenFileName caption:"Select displace image file" filename:locDir types:"All|*.*|"

renderWidth = displaceBitmap.width
renderHeight = displaceBitmap.height

displaceBitMap = bitmap renderWidth renderHeight filename:displaceBitmapStr

displaceTextureMap = bitmaptexture.displaceBitMap
--------------------------------------------------------------------

I thought that you can convert bitmap to type: TextureMap with a string
--------------------------------------------------------------------
displaceTextureMap = bitmaptexture.displaceBitMap
--------------------------------------------------------------------

But I get an error
Unable to convert: BitMap:D:\Imagine\NurbecK@issyk.col\Dest_DHigh.png to type: TextureMap

Comments (1)

Hi Any

SimonBourgeois · 2023-12-04

You can try something like this
(
displaceBitmap = getBitmapOpenFileName caption:"Select displace image file" types:"All|*.*|"

DispBtm = bitmaptexture filename:displaceBitmap

renderWidth = DispBtm.bitmap.width
renderHeight = DispBtm.bitmap.height
)

it will set the render output size to your image size. but i am not sure that it is what you are trying to do...
if you need to put your displacement texture to a material you can just put DispBtm anywhere you need.