POV-Ray : Newsgroups : povray.binaries.images : Mario rendered in Lego : Re: Mario rendered in Lego Server Time
5 Nov 2024 14:21:22 EST (-0500)
  Re: Mario rendered in Lego  
From: Ger
Date: 16 Aug 2006 09:16:20
Message: <44e31aa4@news.povray.org>
scam wrote:

> "RusHHouR" <gee### [at] mailnu> wrote:
>> I agree with most of Tims suggestions.
>> And I too find this a neat idea! Cool theme as well!
>> Cant wait to see the animation(?) =)
>>
>> Are there any borders separating the lego pieces? They look like only one
>> big piece, maybe I have to look again though..
> 
> They are sitting flush, but the edges are rounded so that they just catch
> the light a little. It's kind of wasted in this image though. I'll post
> the first draft of the animation later tonight, however it won't have any
> of the suggestions people have made here. Still, the animation is looking
> pretty good so far.
> 
> Ger <No.### [at] ThankYou> wrote:
>> Not really that hard to do.
>> You know the value of the "sky" color (the blue) so you can fairly easily
>> determine what is not part of the sky. If it is not then raise the block
>> by 1 lego-unit.
> 
> Is there a POV-Ray function that will return the RGB value at a particular
> point in an external image?

#declare MaxWidth = 320; // Or whatever the imagewidth is
#declare MaxHeight = 180; // Or whatever the height is

// You'll need to determine these values from the original images
#declare LowerColLimit = 0.45;
#declare HighColLimit = 0.55;


#local PIMAGE = function {
pigment{image_map {"mario.png"}
rotate x * 90  // rotate backwards
translate < -0.5, 0, -0.5 > // slide over so the center is on <0,0,0>
scale <MaxWidth,1,MaxHeight>//scale to image size
}}

#declare CountH = -div(MaxWidth,2);
#while (CountH< div(MaxWidth,2))
  #declare CountV = -div(MaxHeight,2);
  #while (CountV< div(MaxHeight,2))
    #declare COL=PIMAGE(CountH,1,CountV);
    #if ((COL.blue < LowerColLimit) | (COL.blue > HighColLimit))
      object {LegoBlock pigment { Col } translate <CountH,2,CountV>}
    #else
      object {LegoBlock pigment { SkyBlue } translate <CountH,1,CountV>}
    #end
  #declare CountV = CountV + 1;
  #end
  #declare CountH = CountH + 1;
  #end

This is untested code but it should work
HTH

-- 
Ger


Post a reply to this message

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