Scalable door model with scalable number of boards

Hi, I need help, I’ve been looking for a solution for some time. I have to make a 3d door model so that it can be scaled in height and width. But with the change in width, the number of boards in the door must also change.
An example of the door below in the picturehttps://assets.reno-reno.pl/media/2019/08/Drzwi-przesuwne-DUET-front.jpg

So either you have only planks and you procedurally generate the door (might be slow) or you scale up to a certain point where you add a new board an continue like this.

I am no artist at all so ping @PatrickRyan who will have way deeper insights.

@raxon, the sample you showed has a couple of issues with scaling and I want to understand the guide rails of your implementation before offering a solution.

  • First, are you creating the door with 3D geometry for the vertical boards, horizontal boards, crossing boards, etc. or are you using texture for some of them and geometry for others (like a textured plane for the vertical boards and geometry for the horizontal and crossing boards to show silhouette change)?
  • Are you instead creating the whole door as a plane with a texture that needs to scale to the width of the door?
  • Do you have some other solution different than the ones above?

The texture for the vertical boards is easy in that you can use a tiling texture for just the vertical boards and scale the UVs of the plane to match the scale of your door which will change the number of boards in the door. Even the horizontal boards could be done this way as the tiling texture will look correct.

The main problem is the crossing boards. They need to change their angle based on the width of the door. This is the crux of the challenge here so that is why I am interested in how you are creating the geometry of the door. Let me know if this doesn’t make sense and if you have a playground that illustrates what you are making, I’d love to see it.

yes you are right, the main problem is the crossing boards

I was thinking about 2 solutions, vertical and horizontal textured boards and
a scalable 3d model but I don’t know if it is possible

A friend also mentioned the possibility of using houdini with parametric scaling, but I don’t know how it relates to 3d web models

If I get to a way out, I will definitely share it here

Hi guys!

Are we ready for mad-scientist… textured-single-board-only… experiments?

https://www.babylonjs-playground.com/#15NHLQ#6

Just an instancing-festival away-from complete, now, eh? Pre-set board width, variable door width, so, a little division needed to see how many boards it will take… for the width-span.

If you want COMPLETELY VARIABLE door width, we’ll probably need to do some board “ripping” (length-wise-cut to change its width). Otherwise, door widths must be set to multiples of board widths, I suppose.

The formula to calculate angleOffset should be fun. That angle/distance is VERY dependent-upon door dimensions.

Anyway, we got some starter boards. I’m not much of a carpenter. I hope my angle-cuts are straight.

Yea its very fun :smiley:

Can you describe how you calculate postions point to your example?

Hi,

The only correct way is to use procedural models. Scaling provides worst looking results. It works only with doors with one center panel - and you need to scale the panel individualy from the rails/stiles. Also, scaling ruins the geometry of the arched doors. On the images below rendering of the procedural models.


1 Like

Hi again, Raxon. I will give you a LITTLE starter… for my all-boards method.

https://www.babylonjs-playground.com/#15NHLQ#11

No x-planks in place or their “cut angles” calculated. Also… problems calculating width and positions of head/waist/foot boards. Occurrences of 2.28 should be “derived” somehow, instead of a forced static value like I used. (eyeballed it).

There’s a central PARENT out there in the scene, somewhere, but I have none of the boards parented to it, yet.

Fool-around with the values in lines 81-84. As you can quickly see, this dynamic door generator is not at-all “water-tight”. It’s pretty easy to screw it up.

BUT… if I advance it any further, it might ruin the FUN of this programming challenge. SO, for max fun… “grind it out”. Sometimes I used clones, sometimes instances, maybe all bad ideas… who knows. Door generators are complicated… at least for me. :slight_smile: Just the same, I hope this playground has some useful things in it. Good luck!

Update: Sorry, I couldn’t resist “eye-balling” some x-planks into position.

https://www.babylonjs-playground.com/#15NHLQ#15

Compare-to: https://assets.reno-reno.pl/media/2019/08/Drzwi-przesuwne-DUET-front.jpg

Looks ok. Still, LOTS of slop in the “generator”… like those cutAngle() values… erf. Woodgrain running wrong direction on head/waist/foot boards… well done, Wingnut. :slight_smile:

Nudging and bumping and padding and eyeballing… just a mess… with some z-fighting frosting! Yum.

Do I enjoy pain? :smiley: Does Raxon enjoy pain, too? We must be sick.

1 Like

Yes, you are sick, Wingnut ! :smiley:

But! I came up with one more idea, see the picture below

We have a door here that you made but consisting of planks without cut angles, idea is little
different.
Grey is door in full width and position z to 0 , Red is planks on the top of Grey element with position z for example 1 and Green elements are planks with layer between position grey and red for example position z 0.5.

In this idea when we put red elemens on the top of greeen, Blue element hide behind RED
:smiley:

On the end only calculation to do is calculate rotation angle and position on the center of element.

It was a bit less painful problem for us, but sick too :crazy_face:

1 Like

Hey All ,

@raxon I came up with a different solution (incomplete).

control’s: WASD
W - increase height
S - decrease height
A - decrease width
D - increase width

Parametric Door :upside_down_face:
I couldn’t resist too, same as @Wingnut.

3 Likes

Still not working properly. Failing when the door gets bigger?!
https://www.babylonjs-playground.com/#Q8C4KX#3
I’m missing something in lines 123-137. There I’m trying to find the distance between two points (magic).
Capture

I think @JohnK could help us, he is the best at this.

Edited
Added textures.
https://www.babylonjs-playground.com/#Q8C4KX#7

2 Likes

image

Set sensible values for h, w, d and r (when sizing doors change h and w but not necessarily d and r)

(I think - really just a guess- that in your PG as you enlarge the doors the brace diagonal doesn’t fit properly leading to a sqrt(negative number) - try the following )

a, b and c are angles

then
n = h - 2d

j2 = n2 + w2

k2 = j2 - r2

a = tan-1(r/k)

b = tan-1(n/w)

c = (pi / 2) - a - b

m = r / cos(c )

5 Likes

Thank you @JohnK

Perfect!!!

Just mistake on
b = tan-1(r/k)
should be
b = tan-1(n/w)

https://www.babylonjs-playground.com/#Q8C4KX#8

PARTY!!!

4 Likes

A curse on cutting and pasting and forgetting to change what was necessary :japanese_ogre:

Have edited.

1 Like

“Foldable door” To check the calculations :slightly_smiling_face:

Looks and works epic! Thanks but i have 1 more epic challenge to calculate :smiley:

Planks like JohnK but on the full area planks.
Zrzut ekranu 2020-01-31 o 12.25.26

You guys totally rock. Esp John and Arte… kickin’ butts and taking names. (whatever that means).

I bookmarked these playgrounds SO HARD… that I broke my mouse. :wink:

Raxon, is this a school assignment? If so, you are SO lucky to have these two expert helpers. :slight_smile:

Good advice from Val, too. Scaling a model (its parent) can make a model trash-out. Better to “grow it” with formulas (procedurally)… like everyone is doing here. LOVE IT!

Pat Ryan - helped us gather some more details by asking pertinent questions, and talked about using scaling for “fill areas”… flat panels… nothing that could mess-with arched fine-woodwork, of course. On certain kinds of walls and doors, scaling works great… invaluable.

In case anyone is curious… YES… I HAVE had thoughts of a dynamic log-built ski resort/chalet generator. :slight_smile: erf. When that’s finished and water-tight, we’ll try toothpicks. Then maybe “mud cakes”. Then empty disposable lighters. Then bricked cellphones. :slight_smile: In real life, built by a team of bots! ALRIGHT!

1 Like

Needs tidying up a bit but should be enough for you to work with

https://www.babylonjs-playground.com/#Q8C4KX#16

Hopefully enough comments for you to work with

Line 199 for the function call to play with

1 Like

Implmentation is good but textures are soo bad :frowning:

Black texture is “http://i.imgur.com/tQHOq.png

I think it is the way the CAP for an extrusion is calculated. Instead of using ExtrudeShape (which in your usage builds the edges and caps the surfaces you view) you could try ExtrudePolygon (which in your usage builds the surfaces you see and adds the edge).

There are then a couple of things to think about when (and if) making the change, the shape is given using x and z coordinates in counter clockwise order rather than x and y coordinates and the extrusion is along the z axis only. You would need to rotate the planks about the x-axis. Also when not using a PG you need to import earcut into your project.

1 Like