Skip to content

Commit

Permalink
scaled down by 10
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmuller committed Jun 25, 2023
1 parent b2a6f51 commit 6ce7c0c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__/
backup/
.vscode/
render/
render/
galleries/
Binary file not shown.
Binary file removed otls/brickini.brickini_ldraw_part.1.15.hdalc
Binary file not shown.
Binary file added otls/brickini.brickini_ldraw_part.1.16.hdalc
Binary file not shown.
Binary file modified otls/brickini.brickini_material.1.2.hdalc
Binary file not shown.
12 changes: 5 additions & 7 deletions python3.9libs/convert_ldconfig_to_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import re
import json


resources = Path(__file__).resolve().parent.parent / 'resources' / 'ld_colors.json'
ldconfig = '/home/stefan/ldraw/LDConfig.ldr'

Expand All @@ -12,13 +11,13 @@ def hex_to_rgb(hex_value):
decimal_g = int(hex_value[2:4], 16)
decimal_b = int(hex_value[4:6], 16)

# Convert decimal RGB to linear sRGB
linear_r = (decimal_r / 255) ** 2.2
linear_g = (decimal_g / 255) ** 2.2
linear_b = (decimal_b / 255) ** 2.2
# Convert decimal RGB to float
r = (decimal_r / 255) ** 2.2
g = (decimal_g / 255) ** 2.2
b = (decimal_b / 255) ** 2.2

# Return as list
return [linear_r, linear_g, linear_b]
return [r, g, b]

color_dict = {}

Expand Down Expand Up @@ -48,7 +47,6 @@ def hex_to_rgb(hex_value):
'rgb': rgb
}


with open(resources, 'w') as f:
json.dump(color_dict, f, indent=4)

10 changes: 5 additions & 5 deletions python3.9libs/ldraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ def place_part(color_code, part, geo_node):
def transform_part(node, m4, geo_node):
'''Transforms the part according to the ldraw matrix and adjusts for the houdini coord sys.'''
# compensate for houdini coord sys
# convert from LDU to metric (1 LDU = 0.4mm), however we multiply by 100,
# so 1 brick is 0.8m wide and a minifigure is therefore *very roughly* human scale (3.84 meters tall)
# m4_part = hou.hmath.buildRotate(-180, 0, 0)
# convert from LDU to metric (1 LDU = 0.4mm), however we multiply by 10,
# so a 1x1 brick is 8 cm wide and a minifigure is therefore (38.4 cm tall)
# hopefully this is the right balance to get stable sims and stay in the safe floating point zone
transform_dict = dict()
transform_dict['rotate'] = (-180, 0, 0)
transform_dict['scale'] = (0.04, 0.04, 0.04)
transform_dict['scale'] = (0.004, 0.004, 0.004)
m4_part = hou.hmath.buildTransform(transform_dict, transform_order="srt", rotate_order="xyz")
m4 = m4*m4_part
tr = m4.explode()
Expand All @@ -150,7 +150,7 @@ def transform_part(node, m4, geo_node):

# compensate for houdini coord sys
t.parm('rx').set(180)
t.parm('scale').set(25)
t.parm('scale').set(250)
return t


Expand Down
Binary file modified resources/example_scene.hiplc
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/example_scene.ldr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
1 14 110 -88 -10 0 0 -1 0 1 0 1 0 0 3626b.dat
1 1 80 -24 10 1 0 0 0 1 0 0 0 1 3298p90.dat
1 13 10 -48 -10 0 0 1 0 1 0 -1 0 0 4599a.dat
1 256 40 -24 0 0 0 1 0 1 0 -1 0 0 92409.dat
1 256 40 -22 0 0 0 1 0 1 0 -1 0 0 92409.dat
1 15 110 -56 -10 0 0 1 0 1 0 -1 0 0 2335p30.dat
1 4 70 -24 10 1 0 0 0 1 0 0 0 1 2546p01.dat
1 2 -10 -32 30 0 0 1 0 1 0 -1 0 0 3741a.dat
Expand Down

0 comments on commit 6ce7c0c

Please sign in to comment.