Always snap to grid
Legacy:UArch/USRender
Contents
UnrealScript Renderer[edit]
it is not an actual render device, but instead draws the entire scene onto the canvas
the calculations are all per-pixel which gives the renderer realtime lighting and shadows specular and hopefully other effects in the future :P
the renderer is extremely slow (for obvious reasons) and the renderer runs best at 40x30 to 64x48 it cannot render meshes(only renders the collision cylinders) which makes it quite useless really =P but it was intresting to make
will update description later
First Test version[edit]
black and white lighting only, very simple lighting calculations (no surface normal taken into account) so surfaces lack definition
[[Image:Legacy_usrender_v1_00.jpeg|]]
the cylinder on the bottom left picture is a bot ;)
a short video is available here:
http://uarch.dyndns.org/ur/_Render.avi 3.3MB
Second version[edit]
huge step up from the previous version with colored lighting, specular, and distance fog
this version also lets you take screnshots much larger than the "render resolution" and has settings to enable/disable certain features
some higher resolution pictures which were taken at 256x192(i think) (actual render resolution was 40x30)
[[Image:Legacy_usrender_v2_00.jpeg|]]
[[Image:Legacy_usrender_v2_01.jpeg|]]
also below are 4 comparison screenshots, taken from DM-TDC-Derdak made by Derdak2rot for the theme design contest pack which is available at nalicity http://nalicity.beyondunreal.com/map_hub.php?mid=9122
on the left are normal screenshots of the map and on the right are screenshots with the unrealscript renderer
[[Image:Legacy_compare_00.jpeg|]]
[[Image:Legacy_compare_01.jpeg|]]
Future plans[edit]
volumetric and raytraced fog and possibly some additional lighting effects like coronas or bloom
will probably move this to 2k4 for performance reasons
The Code[edit]
//Made By UArch ;P simulated static final function calclighting(actor a,vector loc,vector norm,vector mirror,out color lightcolor) { local float lr,lg,lb; local float fscale; //fogdist thingy local float dot,dotm; //dot and specular dot local int dist; local vector dir; //direction from the "sample location" to lightsource local urlight l; local float specstart; local bool bshad,bspec,bdfog,bvfog; if(a==none) //ph33r return; bshad=class'ursettings'.default.shadows; bspec=class'ursettings'.default.specular; bdfog=class'ursettings'.default.DistanceFog; foreach a.radiusactors(class'urlight',l,8192,loc) { if(l.lightingradius<=0||(!l.bfixeddir&&vsize(loc-l.location)>=l.lightingradius)||(bshad&&l.bcastshadows&&!a.fasttrace(loc,l.location))) continue; dir = l.location-loc; dot = normal(dir) dot normal(norm); if(dot<0) dot=0; specstart=(1-l.specularlevel); if(specstart<1&&bspec) { dotm = normal(dir) dot normal(mirror); if(dotm<0) dotm=0; } dist = vsize(dir); if(l.bspotlight) { //spotlight calc, not done yet } else if(l.bfixeddir) { //fixed directional light calc, not done yet } else { if(l.bsimple) { lr+=l.lightingcolor.r*((1-float(dist)/(l.lightingradius))*(float(l.lightingcolor.r)/255)); lg+=l.lightingcolor.g*((1-float(dist)/(l.lightingradius))*(float(l.lightingcolor.g)/255)); lb+=l.lightingcolor.b*((1-float(dist)/(l.lightingradius))*(float(l.lightingcolor.b)/255)); if(bspec&&dotm>=specstart) { lr+=(l.lightingcolor.r*((1/specstart)*(dotm-specstart)))*l.specularscale; lg+=(l.lightingcolor.g*((1/specstart)*(dotm-specstart)))*l.specularscale; lb+=(l.lightingcolor.b*((1/specstart)*(dotm-specstart)))*l.specularscale; } } else { lr+=l.lightingcolor.r*((1-float(dist)/(l.lightingradius))*(float(l.lightingcolor.r)/255)*l.lightingscale*dot); lg+=l.lightingcolor.g*((1-float(dist)/(l.lightingradius))*(float(l.lightingcolor.g)/255)*l.lightingscale*dot); lb+=l.lightingcolor.b*((1-float(dist)/(l.lightingradius))*(float(l.lightingcolor.b)/255)*l.lightingscale*dot); if(bspec&&dotm>=specstart) { lr+=(l.lightingcolor.r*((1/specstart)*(dotm-specstart)))*l.specularscale; lg+=(l.lightingcolor.g*((1/specstart)*(dotm-specstart)))*l.specularscale; lb+=(l.lightingcolor.b*((1/specstart)*(dotm-specstart)))*l.specularscale; } } } } if(bdfog&&a.level.fogdistance>0) { fscale = fmin(1,vsize(loc-a.location)/a.level.fogdistance); lr=lr*(1-fscale); lg=lg*(1-fscale); lb=lb*(1-fscale); lr+=a.level.fogcolor.r*fscale; lg+=a.level.fogcolor.g*fscale; lb+=a.level.fogcolor.b*fscale; } lightcolor.r=min(255,lr); lightcolor.g=min(255,lg); lightcolor.b=min(255,lb); }
Version 3[edit]
this was actually done quite a while ago but i forgot to update this page
version 3 features volumetric lighting, soft shadows ambient occlusion, fisheye and panoramic rendering and also a crappy global illumination method which pushes the render time up by several hours..and doesnt look too great either :P having soft shadows and gi basically makes it non-realtime since it takes too long to render each frame
pics:[edit]
Todo:[edit]
work on the realtime renderer a bit more
add better(more evenly distributed) raytracing for soft shadows and global illumination
translucent materials
anti aliasing
Feedback[edit]
Xian: WOW, very impressive. I look forward to seeing the next version, keep up the good work :) It's nice to see another fellow UT developer, since so many moved to UE2 (UT2004 in particular).
UArch should probably update this at some point, light calculation code above is old and..well..crap ;)
UArch should have a nifty update to this code soon, added some optimizations to the renderer mostly to do with soft shadowing and gi, added support for "plug-ins" (dynamically loaded static-classes to add custom ray-tracing methods and such)
gi is still really noisy and well...it sucks to put it simple ;P i need to find an even hackier and faster method!..in uscript i think this may be an impossibility