Joined: Apr 22, 2016
Post Count: 8
Status:
Offline
3D rendering question
Hi bros,
I load a 5 piece door like in image from obj file. I want to render in 3D that can keep piece fixed size is 70mm for left, top, right and bottom piece. Thank you so much for any help or any diea.
Joined: Apr 22, 2016
Post Count: 8
Status:
Offline
Re: 3D rendering question
Hi,
Thank you so much for your answer,
It mean I load object from obj file. The object contain 5 piece door as in image. When i change ojbect size (width, height or depth), I want control 3D render which can keep 4 piece on door fixed size, just change the center piece of door.
Sorry for my bad English. Waiting for your answer. Thanks!
Joined: May 12, 2013
Post Count: 1545
Status:
Offline
Re: 3D rendering question
keep 4 piece on door fixed size, just change the center piece of door
If I understand correctly, you probably want to edit the .obj with another software. The only way I know to do this with SH3D is if the centre piece has a different colour in the SH3D file (that is a different material in the .mtl file. Then you can set first the centre piece to invisible and export the rest. Then set the rest to invisible, make the door visible, and export. Then you have two different element you can import individually, scale and fit together with SH3D.
But, editing the .obj file with other software is probably easier.
Joined: Apr 22, 2016
Post Count: 8
Status:
Offline
Re: 3D rendering question
Sorry for wrong meaning about question. I loaded obj file, in the applet, when i resize cabinet has 5 piece door above, but when i resized it, cabinet scale all piece by ratio. So 4 piece of out side scaled,too. I already fixed size for them. But it's take effect for every cabinet on same original model. I try modify ModelManager.java and HomePieceOfFurniture3D but not lucky.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: 3D rendering question
Every part of a 3D model is proportionally enlarged or reduced when you resize it. If you want that the frame of the door keeps the same width for a larger door, you'll have to use other software like Blender.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Apr 22, 2016
Post Count: 8
Status:
Offline
Re: 3D rendering question
Hi Emmanuel Puybaret,
That's what i need. I'm using Blender to create object, but how can i do to keep the frame of the door keeps the same width for a larger door on Blender? You mean I need to create other model for the same cabinet? Thank you so much!
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: 3D rendering question
Blender is not easy to learn but once mastered, it’s a great tool to update vertices in a 3D model, moreover because it preserves pretty well OBJ files at import/export. If you want a larger cabinet you’all have to modify its 3D model and save it as an other OBJ file. Good luck!
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Joined: Apr 22, 2016
Post Count: 8
Status:
Offline
Re: 3D rendering question
Finally, I solved it by modify Piece of Cabinet on UpdatePieceOfFurnitureModelNode funcion. But it's a bit slower Any idea or improve that code.
/** * Updates transform group children with <code>modelMode</code>. */ public void updatePieceOfFurnitureModelNode(Node modelNode, TransformGroup normalization, boolean ignoreDrawingMode, boolean waitTextureLoadingEnd) {
normalization.addChild(modelNode); setModelCapabilities(normalization); // Add model node to branch group BranchGroup modelBranch = new BranchGroup(); modelBranch.setCapability(BranchGroup.ALLOW_CHILDREN_READ); modelBranch.setCapability(BranchGroup.ALLOW_CHILDREN_WRITE); modelBranch.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND); modelBranch.setCapability(BranchGroup.ALLOW_DETACH); modelBranch.addChild(normalization);
if (!ignoreDrawingMode) { // Add outline model node modelBranch.addChild(createOutlineModelNode(normalization)); }
// TransformGroup transformGroup = (TransformGroup)modelNode; TransformGroup transformGroup = (TransformGroup)getChild(0); // Remove previous nodes transformGroup.removeAllChildren(); // Add model branch to live scene transformGroup.addChild(modelBranch);
if (piece instanceof HomeLight) { BranchGroup lightBranch = new BranchGroup(); lightBranch.setCapability(ALLOW_CHILDREN_READ); HomeLight light = (HomeLight)piece; for (int i = light.getLightSources().length; i > 0; i--) { PointLight pointLight = new PointLight(new Color3f(), new Point3f(), new Point3f(0.25f, 0, 0.0000025f)); pointLight.setCapability(PointLight.ALLOW_POSITION_WRITE); pointLight.setCapability(PointLight.ALLOW_COLOR_WRITE); pointLight.setCapability(PointLight.ALLOW_STATE_WRITE); BoundingLeaf bounds = (BoundingLeaf)getChild(1); pointLight.setInfluencingBoundingLeaf(bounds); lightBranch.addChild(pointLight); } addChild(lightBranch); }
// Flip normals if back faces of model are shown if (piece.isBackFaceShown()) { setBackFaceNormalFlip(getFilledModelNode(), true); }
} catch (Exception ex) {
}
// Update piece color, visibility and model mirror in dispatch thread as // these attributes may be changed in that thread updatePieceOfFurnitureModelMirrored(); updatePieceOfFurnitureColorAndTexture(waitTextureLoadingEnd); updateLight(); updatePieceOfFurnitureVisibility();