Skip to content

Commit

Permalink
feat(genbox): Added polygonal modeling of rounded edges and -o option…
Browse files Browse the repository at this point in the history
… for .OBJ
  • Loading branch information
Gregungory committed Apr 9, 2021
1 parent f38a7f3 commit a48ece8
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 52 deletions.
58 changes: 48 additions & 10 deletions doc/man/man1/genbox.1
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
.\" RCSid "$Id: genbox.1,v 1.4 2007/09/04 17:36:40 greg Exp $"
.\" RCSid "$Id: genbox.1,v 1.5 2021/04/09 01:48:20 greg Exp $"
.TH GENBOX 1 11/15/93 RADIANCE
.SH NAME
genbox - generate a RADIANCE description of a box
genbox - generate a RADIANCE or Wavefront description of a box
.SH SYNOPSIS
.B "genbox mat name xsiz ysiz zsiz"
[
.B \-i
][
.B "\-r rad"
|
.B "\-b bev"
|
.B "\-r rad"
[
.B "\-n nseg
]
][
.B \-o
]
.SH DESCRIPTION
.I Genbox
Expand All @@ -22,24 +27,57 @@ The surfaces that make up the box will be modified by
.I mat
and their identifiers will begin with
.I name.
.PP
The
.I \-i
option can be used to produce a box with inward directed surface
normals.
The
.I \-r
option can be used to specify the radius for rounded edges.
.PP
The
.I \-b
option can be used to specify the indentation for beveled edges.
.PP
The
.I \-r
option can be used to specify the radius for rounded edges, which
are modeled as cylinders and spheres for non-inverted RADIANCE output.
However, this type of model only makes sense for external views of
an opaque object.
If a rounded box is inverted using
.I \-i,
then the corners and edges are modeled with polygons, instead.
This option can also be forced by specifying a minum number of
segments with the
.I \-n
option.
.PP
The
.I \-o
option specifies Wavefront .OBJ output, and
also forces polygons to be used with the
.I \-r
option.
In this case, vertex normals are also produced for smooth rendering.
.SH EXAMPLE
To produce a rectangular box made of wood with beveled edges:
To produce a rectangular box made of wood with rounded edges:
.IP "" .2i
genbox wood box1 5 8 3 \-r .5 > box1.rad
.PP
To produce a box made of crystal with beveled edges:
.IP "" .2i
genbox wood box1 5 8 3 \-b .5 > box1
genbox crystal box2 3 7 1 \-b .1 > box2.rad
.SH AUTHOR
Greg Ward
.SH BUGS
Because spheres and cylinders are used to construct boxes with
rounded edges, a transparent box of this type appears quite messy.
The preferred alternative in this case is the
.I \-n
option, which produces polygons, instead.
However, normal smoothing is only applied to the Wavefront .OBJ output,
so this must be passed through
.I obj2rad
to get perfectly smooth results.
.SH "SEE ALSO"
genrev(1), gensurf(1), genworm(1), rpict(1), rvu(1), xform(1)
genrev(1), gensurf(1), genworm(1), obj2mesh(1), obj2rad(1),
robjutil(1), rpict(1), rvu(1), xform(1)
3 changes: 3 additions & 0 deletions doc/notes/ReleaseNotes
Original file line number Diff line number Diff line change
Expand Up @@ -2434,3 +2434,6 @@ Added pabopto2bsdf -g option to cull near-grazing scattering to avoid
issues with noise and negative values.

Increased default dynamic range from 32 to 100 in pcond and normtiff.

Added -o and -n options to genbox to create .OBJ output and segment
edges and corners for transparent materials.
2 changes: 1 addition & 1 deletion src/gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ add_executable(genbeads genbeads.c hermite3.c)
target_link_libraries(genbeads ${LIB_M})

add_executable(genbox genbox.c)
target_link_libraries(genbox rtrad)
target_link_libraries(genbox rtrad wfobj)

add_executable(genmarble genmarble.c ../common/random.h)
target_link_libraries(genmarble ${LIB_M})
Expand Down
6 changes: 4 additions & 2 deletions src/gen/Rmakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCSid: $Id: Rmakefile,v 2.38 2020/07/25 19:23:09 greg Exp $
# RCSid: $Id: Rmakefile,v 2.39 2021/04/09 01:48:20 greg Exp $
#
# Makefile for object generation programs
#
Expand Down Expand Up @@ -35,7 +35,7 @@ genbeads: genbeads.o hermite3.o
$(CC) $(CFLAGS) -o genbeads genbeads.o hermite3.o $(MLIB)

genbox: genbox.o
$(CC) $(CFLAGS) -o genbox genbox.o -lrtrad
$(CC) $(CFLAGS) -o genbox genbox.o -lrtrad -lwfobj

genmarble: genmarble.o ../common/random.h
$(CC) $(CFLAGS) -o genmarble genmarble.o $(MLIB)
Expand Down Expand Up @@ -100,6 +100,8 @@ gensurf.o xform.o: ../common/standard.h \
../common/rtmath.h ../common/rterror.h \
../common/mat4.h ../common/fvect.h

genbox.o: ../common/fvect.h ../common/objutil.h ../common/rtio.h

genworm.o genrev.o gensurf.o: ../common/resolu.h ../common/rterror.h

xform.o: ../common/otypes.h ../common/object.h
Expand Down
Loading

0 comments on commit a48ece8

Please sign in to comment.