Multi-Surfaced Blobs Here it is! The "alpha" code for supporting multiple surfaced blobs in Rayshade. I say "alpha" because it, the code, has been tested, but not rigourously. It seems simple enough to implement and try that I feel it should be available to those who want to use it. Above all, I want everyone interested in this to have some source with which to experiment and have some fun! Please send me any comments or suggestions for improving the code, speeding it up, or just general style issues. I want to thank Mark Podlipec for all his help in getting this running (read: If it weren't for him I might still be thrashing about helplessly). Kudos, of course, to everyone who has helped make Rayshade available to even the most novice developers, like myself. I have tar'red and compressed only the "necessary and sufficient" files for making multi-surfaced blobs. All you need to do is uncompress and untar the file 'CBlob.tar.Z' in the top level Rayshade directory and you should have a subdirectory 'cblob' with the necessary files in it. Next you need to put them into the their proper directories(see below) and recompile, but please back up the original files first! :-) The names of the files in CBlob.tar are identical to the Rayshade distribution files. Using Multi-Surfaced Blobs Multi-surfaced blobs have been implemented, at this time, as a new object. This object is called a "cblob". Anything you can do to a "blob" you can do to a "cblob". Here's the catch, the syntax for a "cblob" is different, but only _VERY_ slightly. The "cblob" has, after each coordinate triple for a metaball, the metaball's particular surface specification. For example, below is the "cblob" specification derived from Mark's blob example file "blob.ray": /* * Example blob input file, courtesy of Mark Podlipec * Modified for multi-surfaced blob (i.e. cblob) by George McGregor */ eyep 0.0 -6.0 1.0 lookp 0.0 0.0 0.0 fov 45. 45. screen 240 240 light 1.4 point 15. -20. 25. light 0.7 point 5. -25. 10. surface white ambient .02 .02 .02 diffuse .5 .5 .5 specular .8 .8 .8 specpow 32 surface bland ambient .02 .02 .02 diffuse .5 .5 .5 specular .8 .8 .8 specpow 32 /* Note: Seperate surfaces for each metaball... which may not be necessary */ surface crystal diffuse .03 .03 .08 reflect 0.03 transp 0.96 index 1.5 surface greensmoke diffuse .01 .05 .01 reflect .10 specpow 30 specular .8 .85 .8 surface blueglass diffuse .09 .15 .45 specular .5 .5 .6 reflect .5 surface gold diffuse 0.22 0.18 0.05 specular .8 .8 .4 ambient .04 .02 .0 reflect 0.93 specpow 58 surface ceramic diffuse 0.6118 0.6794 0.7471 ambient 0.2039 0.2265 0.2490 specular .5 .5 .5 specpow 25 surface plaster diffuse 0.6735 0.6059 0.4465 ambient 0.2245 0.2020 0.1388 surface silver diffuse .02 .02 .04 specular .71 .71 .7 reflect .95 specpow 70 /* surface treshhold strength radius x y z surface */ /* | | | | | | | | | */ /* V V V V V V V V V */ cblob bland 0.6 1.0 1.0 -0.900 0.000 0.000 plaster 1.0 1.0 0.900 0.000 0.000 greensmoke 1.0 1.0 0.000 0.000 -0.900 ceramic 1.0 1.0 0.000 0.000 0.900 silver plane white 0. 0. -3.77 0 0 1 Please note the multiple surface specifications, one for each metaball in the "cblob". As Mark pointed out to me, surfaces are global and it would be a good idea to make the "cblob"'s surface specification unique. I am certain that with a better understanding of the yacc parser and a little more work I can make the "blob"/"cblob" objects into one description. e.g. the surfaces for the metaballs would be optional and thus make the single surface "blob" the default case. Also, it would be nice to be able to specify a surface once and have that surface used as a default for subsequent metaballs until a new surface specification is given. I have attempted these cases, but the shift/reduce errors and parsing glitches forced me to getting the "cblob" working first. I am hoping Mark, or someone who is more familiar with these sorts of things can point me in the right direction. I apologize if I have left anything out, and I look forward to any constructive commentary about this code. I will be placing this in our anonymous ftp directory under pub/rayshade as well as at the weedeater site. Ftp'ing details for ncifcrf.gov: ftp fcs280s.ncifcrf.gov -or- ftp 129.43.2.10 [login as "anonymous" and password in user@host form.] cd pub/rayshade Now you may get the files. Oh, yes, be sure to set to binary to before you grab the .Z files. They should all have the CBlob prefix. The weedeater details have been covered elsewhere. I will place the files in the incoming directory. Again, they should all have the CBlob prefix. If you have any problems you can reach me at the adresses below. Enjoy! George George McGregor @ NCI Biomedical Supercomputer Center c/o PRI, Inc. Phone: (301) 846-5789 PO Box B, Bldng. 430 mcgregor@ncifcrf.gov Frederick, MD 21702 mcgregor@fcs280s.ncifcrf.gov NOTE: The original locations for these modified, source files are as follows: [relative to the top rayshade directory] File original location ---- -------- -------- blob.c libray/libobj/blob.c blob.h libray/libobj/blob.c yacc.y libshade/yacc.y lex.l libshade/lex.l cblob.ray can go into Examples/cblob.ray color.h libray/libcommon/color.h