[Closed] Bitmap Transform
Hi everybody,
I have 2 little questions about bitmap transform.
Is it possible to desaturate a bitmap by MaxScript ?
Is it possible to blur a bitmap by MaxScript ?
It’s because i use a script to make a virtual viewport, and i render my actual viewport as a bitmap to it, and i want to see it in greyscale or blured (for lighting is cool to have this vision).
Thanks
Rob
are you using max 2008 or up? you can just use a color correction map in the environment map slot. you can perform many image adjustments and this will show up in vpt background.
i’m using max 9…
That isn’t for render but for realtime. I’m using directX shader with vertexColor in my scene.
Here is the script i’m using for duplicate my viewport :
rollout t "Virtual viewport" width:200 height:200
(
bitmap w "" width:200 height:200
fn virtualViewport =
(
w.bitMap = gw.getViewportDib()
--colors = getPixels w.bitmap [0,0] 200
--print colors
)
on t open do
(
virtualViewport()
registerRedrawViewsCallback virtualViewport
)
on t close do
(
unRegisterRedrawViewsCallback virtualViewport
)
on t resized size do
(
x = gw.getWinSizeX()
y = gw.getWinSizeY()
w.width = size.x
w.height = size.y
if size.x > x do
(
t.width = x
w.width = x
)
if size.y > y do
(
t.height = y
w.height = y
)
)
)
createDialog t style:#(#style_resizing,#style_minimizebox,#style_titlebar,#style_border,#style_sysmenu)
Do you mean something like this?:
(0.3pixelVal.x + 0.59pixelVal.y + 0.11*pixelVal.z)
That will return a pixel’s luma value. So just assign that value to pixelVal.x, pixelVal.y, and pixelVal.z and you’ve got a grayscale. Since you’re doing this to a bitmap, remember to read entire rows of pixels at a time, as it is more than twice as quick as doing it one pixel at a time.
As for blurring, I’d assume some research on convolution algorithms would get you what you need.
To do it in realtime, you would have to use Viewport shaders (scene shaders).
Max does support them, though they are poorly documented and don’t always work.
But blurring and desaturate should be possible.
Thanks for reply
I will try that handiklap
knees: what is scene shaders ?
Utilities > More… > Scene Effect Loader.
This allows you to load DirectX Scene Effects, that effect the whole viewport. Max ships with a few samples to do various effects (\maps\fx\scene).
-Eric