Home Technical Talk

trying to make a lens texture + reflection

polycounter lvl 13
Offline / Send Message
supaclueless polycounter lvl 13
I'm trying to make a lens texture but i'm kinda stumped and google really isnt helping me one bit >.<.... I understand the basics for reflections and cubemapping showing on the lens but thats almost as far as I go....so my question I guess is how do you texture a lens material for a diffuse which gives the lens a thick glass look while reflecting the environment like most scopes in video games (forgive meh if I sound like a horrid amateur)

lens i'm trying to make...its a spyglass
PS: ignore the atrocious textures...

QzPIR.jpg

what I desire to achieve lens-wise (model by Fewes)
http://fewes.se/images/temp/aimpoint_01.jpg

Replies

  • Computron
    Offline / Send Message
    Computron polycounter lvl 7
    Play around with fresnel masking for your reflections, adding a little transparency maybe with some geo behind the lens, oh and material deffinition is important, so play around with your spec.
  • rollin
    Offline / Send Message
    rollin polycounter
    do you want to do this with the shader (as you mention cubemaps) or simply on the diffuse?

    In the first case you don't to that much on the diffuse. make it bit darker so you get a nice contrast to the cubemap

    if you paint it in you can start with a blured and distorted photo of the scene the spyglass is most likely looking at.
  • supaclueless
    Offline / Send Message
    supaclueless polycounter lvl 13
    @computron gonna have to try that out once i fully understand more about fresnel masking as i'm still oblivious about it

    @rollin I'm using xoliushader 2 so yea i have a cubemap and imah try ur tips and see how it goes >.<

    thx for tips btw
  • supaclueless
    Offline / Send Message
    supaclueless polycounter lvl 13
    first attempt at it...still might need to play more with the textures and whatnot maybe >.<

    CNKSm.jpg

    btw...does anyone know how to actually save the alpha channel in a diffuse folder in psd with Vtools...it doesnt really seem to work for me (using cs4 btw) (vtools is supposingly able to only support cs3)
  • m4dcow
    Offline / Send Message
    m4dcow interpolator
    btw...does anyone know how to actually save the alpha channel in a diffuse folder in psd with Vtools...it doesnt really seem to work for me (using cs4 btw) (vtools is supposingly able to only support cs3)

    It depends on your setup, but I use "associate with marked sets" and what you have to do is name a certain alpha channel the name of the set you want it save out with. IE: if you had a "diffuse" layer set, you would name the correspondiong alpha channel "diffuse".
  • arrangemonk
    Offline / Send Message
    arrangemonk polycounter lvl 17
    refraction(inside of lookingglass) and reflection cubemap (environment), angle = alpha
    and you need to use the object spacenfor the refraction
  • supaclueless
    Offline / Send Message
    supaclueless polycounter lvl 13
    @m3dcow thx...i was reading the tooltip in a wrong way...i thought it was saving if under the folder group...stupid me

    @arrangemonk....I know this is gonna sound bad but...do you mind telling me how i could create refractions using object space >.<.... would you use the diffuse with a gradient? I only recently learned about environment reflections and its basic (forgive meh if i sound like a spoon feeder btw)
  • arrangemonk
    Offline / Send Message
    arrangemonk polycounter lvl 17
    you need to take objectspace int account because the refraction has to be relative to the orientation of the object. cubemaps usually are not relative to objects.
    if i was to implement such a shader, i would somehow find the right way (after alot of thinking), but i cant tell without trying
    but refraction n 3dgraphics is basically the same as reflection(cubemaps), but using a refraction vector instead of a reflection vector

    i talked to some codeguru,
    there are several possibilities, but thats some work.

    1. half cubemap for inside, which has to use the objectspace of the spyglass
    assuming that the 0 point of the spyglass is the cenmter of the lense
    + 1 cubemap for environment
    + calculations for reflection and refraction(or you use normalmap for reflection and make a refraction map)

    an then you just blend them together (dotproduct of lens and normal vector is your blendvalue)

    2nd is almost the same but you use a spheremap for the spyglass interiour
    would be about the same result but with better performence)

    3rd you render without lens then draw the lens over it with specific calculations (code)
  • supaclueless
    Offline / Send Message
    supaclueless polycounter lvl 13
    hmmm...i'll try the method which you described after i get back home from high-school...been playing yesterday around on how transparency works around and on an object and i realized too that using worldspace for a cubemap is not the best for a lens

    I have one more question tho.....from what ur saying in your last paragraph...would it be possible to do the scope-styled reflection w/o using Vray and mentalray (this is what i think ur describing by rendering the lens then drawing the lens over it)

    thx for all the help you've been providing tho and for ur patience with meh :D
  • arrangemonk
    Offline / Send Message
    arrangemonk polycounter lvl 17
    third method had something todo with rendering order in engines
    half life water is done somewhat like that
  • supaclueless
    Offline / Send Message
    supaclueless polycounter lvl 13
    my 2nd quick attempt...i decided to try out the first method and it looks slightly better...i'm using a placeholder cubemap coz now i need to learn how to make a cubemap for the spyglass..but i'm "hopefully" understanding how it kinda works now tho...and i realized that if i want to achieve full refraction + reflection i prolly have to move to a game engine like UDK....thanks for the example of HL btw...i kinda get the concept of how it works now by reading their dev wiki :D

    dSNqB.jpg

    i'm still a FAR way from doing reflections and refractions properly...but i'll get there someday!
Sign In or Register to comment.