POV-Ray : Newsgroups : povray.binaries.images : Doghouse : Re: Doghouse Server Time
2 Aug 2024 14:19:55 EDT (-0400)
  Re: Doghouse  
From: triple r
Date: 23 Oct 2007 00:25:00
Message: <web.471d77561319a9ad88727a860@news.povray.org>
"alphaQuad" <alp### [at] earthlinknet> wrote:

> well first off, its home page says,
> Povray 3.5 export plug-in
> Download it from KayosIII's Wings Plugin Page.
>
> and you get:
> Not Found
> The requested URL /~rgcoy/software.html was not found on this server.
>
> are there any solutions to these issues?
> otherwise, I'd say, almost useful.

Well I'm not sure about the manual.  Search for Blender or Silo tutorials
and you can probably pick up the basics as it's fairly universal.  Or maybe
a different PDF viewer.

I never got any kind of plugin to work.  Instead, I tried the various file
formats by trial and error.  It turns out that the .obj file is identical
in format to a mesh2 object.  It comes down to parsing and writing the data
with only formatting differences.  I have a lengthy and SLOW shell script I
could send you, and I'm also tinkering with a c program that does the same.
 Neither are extremely robust, but it works fine for uv-mapping too.  Try
exporting a .obj file for a cube or something simple and notice the
formatting.  'v' lines are vertices, 'vn' lines are vertex normals, and
1//1 2//2 3//3 lines contain face and normal indices (usually the same).

What the hey--here's the shell script I've been using.  Now I'll go hang my
head in shame.  It's that bad.  It basically parses the file multiple
times, separating the contents into different files.  Then it recombines
them into a mesh2 object.  Works fine for moderately-sized object.  Just
export a .obj file with triangulation and run the script.  I guess I've
been assuming you use Linux, so if this doesn't work, I might be able to
get my c parser pared down.  Right now it does some other stuff for a
specific purpose.  I'm sure someone else will post the plugin and this will
fall into a void, but I'm a do-it-yourself-er.  Hope it's worth something to
someone.

 - Ricky


input=object.obj
output=`echo "$input" | sed -e 's/.obj/.pov/'`
name=`echo "$input" | sed -e 's/.obj//'`
echo "converting '$input' to '$output'."
rm -f $output

cat $input | sed -e 's/////1//g' > $output
mv $output $input

#VERTICES:
echo "Saving vertex vectors..."
vertices=`echo "$input" | sed -e 's/.obj/.vert/'`
vertices2=`echo "$input" | sed -e 's/.obj/.vert2/'`
cat $input | grep "^v " | sed -e "s/v *([[:digit:].e+-]*)
*([[:digit:].e+-]*) *([[:digit:].e+-]*).*/<1,2,3>,/g" > $vertices
vertlines=`wc -l $vertices | sed -e 's/[ t]*([[:digit:]]*).*/1/g'`
vertlines1=`expr $vertlines - 1`
head -n $vertlines1 $vertices > $vertices2
tail -n 1 $vertices | sed -e 's/,$//g' >> $vertices2
mv $vertices2 $vertices

#VERTEX NORMALS
echo "Saving vertex normals..."
vertexn=`echo "$input" | sed -e 's/.obj/.vertn/'`
vertexn2=`echo "$input" | sed -e 's/.obj/.vertn2/'`
cat $input | grep "^vn " | sed -e "s/vn *([[:digit:].e+-]*)
*([[:digit:].e+-]*) *([[:digit:].e+-]*).*/<1,2,3>,/g" > $vertexn
nvertlines=`wc -l $vertexn | sed -e 's/[ t]*([[:digit:]]*).*/1/g'`
nvertlines1=`expr $nvertlines - 1`
head -n $nvertlines1 $vertexn > $vertexn2
tail -n 1 $vertexn | sed -e 's/,$//g' >> $vertexn2
mv $vertexn2 $vertexn

#UV VECTORS
#echo "Saving uv vectors..."
#uv=`echo "$input" | sed -e 's/.obj/.uv/'`
#uv2=`echo "$input" | sed -e 's/.obj/.uv2/'`
#cat $input | grep "^vt " | sed -e "s/vt *([[:digit:].e+-]*)
*([[:digit:].e+-]*).*/<1,2>,/g" > $uv
#uvlines=`wc -l $uv | sed -e 's/[ t]*([[:digit:]]*).*/1/g'`
#uvlines1=`expr $uvlines - 1`
#head -n $uvlines1 $uv > $uv2
#tail -n 1 $uv | sed -e 's/,$//g' >> $uv2
#mv $uv2 $uv

#FACE INDICES
echo "Saving face indices..."
faces=`echo "$input" | sed -e 's/.obj/.faces/'`
faces2=`echo "$input" | sed -e 's/.obj/.faces2/'`
cat $input | grep "^f " | sed -e "s/f
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*)
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*)
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*).*/<1-1,4-1,7-1>,/g" > $faces
nfaces=`wc -l $faces | sed -e 's/[ t]*([[:digit:]]*).*/1/g'`
nfaces1=`expr $nfaces - 1`
head -n $nfaces1 $faces > $faces2
tail -n 1 $faces | sed -e 's/,$//g' >> $faces2
mv $faces2 $faces


#UV INDICES
#echo "Saving uv indices..."
#uvi=`echo "$input" | sed -e 's/.obj/.uvi/'`
#uvi2=`echo "$input" | sed -e 's/.obj/.uvi2/'`
#cat $input | grep "^f " | sed -e "s/f
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*)
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*)
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*).*/<2-1,5-1,8-1>,/g" > $uvi
#nuvi=`wc -l $uvi | sed -e 's/[ t]*([[:digit:]]*).*/1/g'`
#nuvi1=`expr $nuvi - 1`
#head -n $nuvi1 $uvi > $uvi2
#tail -n 1 $uvi | sed -e 's/,$//g' >> $uvi2
#mv $uvi2 $uvi


#NORMAL INDICES
echo "Saving normal indices..."
normal=`echo "$input" | sed -e 's/.obj/.normal/'`
normal2=`echo "$input" | sed -e 's/.obj/.normal2/'`
cat $input | grep "^f " | sed -e "s/f
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*)
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*)
*([[:digit:]]*)/([[:digit:]]*)/([[:digit:]]*).*/<3-1,6-1,9-1>,/g" > $normal
nnormal=`wc -l $normal | sed -e 's/[ t]*([[:digit:]]*).*/1/g'`
nnormal1=`expr $nnormal - 1`
head -n $nnormal1 $normal > $normal2
tail -n 1 $normal | sed -e 's/,$//g' >> $normal2
mv $normal2 $normal


#ASSEMBLING POV-RAY FILE
echo "Saving POV-Ray output file..."
echo "#declare $name=mesh2{" > $output
echo 'vertex_vectors{' `wc -l $vertices | sed -e 's/[t
]*([[:digit:]]*).*/1/g'`, >> $output
cat $vertices >> $output
echo '}' >> $output
echo 'normal_vectors{' `wc -l $vertexn | sed -e 's/[t
]*([[:digit:]]*).*/1/g'`, >> $output
cat $vertexn >> $output
echo '}' >> $output
#echo 'uv_vectors{' `wc -l $uv | sed -e 's/[t ]*([[:digit:]]*).*/1/g'`, >>
$output
#cat $uv >> $output
#echo '}' >> $output
echo 'face_indices{' `wc -l $faces | sed -e 's/[t ]*([[:digit:]]*).*/1/g'`,
>> $output
cat $faces >> $output
echo '}' >> $output
echo 'normal_indices{' `wc -l $normal | sed -e 's/[t
]*([[:digit:]]*).*/1/g'`, >> $output
cat $normal >> $output
echo '}' >> $output
#echo 'uv_indices{' `wc -l $uvi | sed -e 's/[t ]*([[:digit:]]*).*/1/g'`, >>
$output
#cat $uvi >> $output
#echo '}' >> $output
echo '}' >> $output


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.