Monday 15 August 2011

unity3d - How to scale a beveled rectangular prism, without destroying the aspect ratio of the corners in Unity -



unity3d - How to scale a beveled rectangular prism, without destroying the aspect ratio of the corners in Unity -

i making 3d virtual keyboard , keys made rectangular prism meshes rounded corners / beveled edges. made mesh blender , works fine. except depending on device orientation etc aspect ratio of keys change. have been achieving doing scale transform distorts corner rounding.

in 2d handled scale 9 algorithms scale middle , length of sides not corners.

is there mutual way of doing in unity?

maybe there easy way render rounded corners after transform on regular cube?

or specify way mesh scales areas remaking static?

or building own mesh code? there illustration of this? building mesh of rectangular prism seems doable - rounding corners seems formidable task.

all depends on how much bevelling needed. if little, possible shader without touching mesh. can post processing in accepted reply of this question links this paper.

other alternative little beveling utilize relief mapping in this question. easier create dynamic changes relief mapping texture model.

if multiple pixels of beveling needed, think mesh needs modified. (hopefully proofs i'm wrong , tells weird scaling.) making whole mesh script quite easy mesh 1 time used it. depending on amount of 3d experience, might take lot of time round edges working correctly.

another thought create 1 model corners, 1 model edges , 1 model sides. can utilize 6 instances of corners, 6 instances of stretched edges , 6 scaled sides create finish cube out of them.

unity3d unityscript

No comments:

Post a Comment