Hi man! :)
How do I set the width and height measurements in rendering (setup) that fit a selected object in the top view?
Situation:
I have an object
I create a freecamera in Top Viewport
Renders the camera
The image (vfb) must correspond to an BoundigBox surrounding object
For the first three steps and dummy box are successful, but the last I do not understand how to do...
Do you have any suggestions?
Ciao
Michele
By
Comments (12)
Comment policy
ok i had an hour to kill so i thought why not improve the code and document it.. reason being that i so far havent seen one working approach to scripted baking on any forum
its not verry dynamic but i think with the comments anyOne can fit it to their needs
its still using a cage not a ray offset value but i bet ill be bored again the next few days so look forward to another improvement, still unsure on how to get the projection going without the mod.. but well see
Thank you again for taking the time and patience for my problem :)
You have been extremely useful and very clear :) :) I hope to learn something more from your help ;)
Grazie
Michele
Thanks again for your clear and precise explanations Insanto! :)
the size is always the max x or y depending on whats bigger, the only thing is that its squared.. i know there is a solution but oh well .. at the verry least you could rendermap resize it with filtering on should be ok
your approach is valid too but it doesnt work with objects using real world map coords thats why i used this way. and its the same speed to render. (mine doesnt use lighting but needs to resize the map at the end (new code))
there are always many solutions to 1 problem, like my hacky one to the aspect issue :P
you could've tried to solve it propperly but i already know that if you dont switch to scanline and bake with MR you cant solve it so rendermap it is, have phun
Wow! is completely different from what I imagined! It works great and now, I study your solution (very interesting)...
It would be wonderful to determine the size of the bitmap :) Now I see how can proceed.
My solution script for heightmap is not valid? What do you think?
Thank you enormously for the response, resolution and patience you had with me
Best Regards
Michele
its a scope issue, you didnt define d as local higher up than the for loop.. so when the loop ends d ref is gone
aanyways, heres my approach to this:
its got that nasty habbit of keeping a 1:1 aspect ratio.. i knew the answer to that prob a while back but forgot it again ;) your a smart gal, youll figure it out
have phun
?yes it is?but you know that
?yes it is?
but you know that d is undefined in your code right?
imo you really should propperly define your scopes and make the code a little neater
what you wanna do is create heightmaps for all objects in the scene?
hang on a sec ill whip something up
This script is a work in progress this is the reason why it is so messy in the development...
The heightmap must be only for the object selected.
Why d (dummy) is undefined? it is defined when I create dummy or not?
why not make a bbplane below the scene and bake your stuff to it?!
can you upLoad or send me a sample maxScene to clarify and tell what you want as a result?
Ok,try this: Create a Teapot in any viewport and run the script_test below (still under construction):
As you can see, the measure (outputSize) of final rendering (Top) IS NOT EQUAL to measure of BoundingBox... For example, if BoundingBox measure 30X30 (Width/Heigth), the outputSize of renderig must be 30x30
Ciao Insanto and thanks for the reply:)
So, let me explain better;
I created a script that allows me to create a HightMap starting from any object.
Now, I want to render in Top view the object, and create a Bitmap of HightMap.
The rendering must have the same measures of the object (a BoundingBox surrounding the object)so that it fit the object... very similar to #boxselect type rendering in max 8.
With obj.max-obj.min I have found a way to build the BoundingBox that surrounding the object.
It 'can get the length and height of the BoundingBox and transfer these measurements to create the rendering outputSize?
so you dont know how to zoom into it propperly so itll fit the whole screen or you dont know how to translate the worldSpace bb into screenspace?
if you just want the dimensions to use in the render props you can do something like
(local dims = obj.max-obj.min;[dims.x,dims.y])
or do you want the vfb to maintain the current resolution but change it's aspect ratio?
it seems a tad odd to me to change the render res based on an objects dimensions, but that may just be me