Home Technical Talk

LitSpheres in Max viewport

2

Replies

  • arrangemonk
    Options
    Offline / Send Message
    arrangemonk polycounter lvl 15
    thats what i meant :D
  • rollin
    Options
    Offline / Send Message
    rollin polycounter
    arrangemonk: you can take a look at my (toon) shader.. it supports several texture slots you can enable/disable .. including lightspheres and diffuse

    I hope I'm not capturing this thread with this advertisement.. so kill this post if you think so!
  • javi
    Options
    Offline / Send Message
    javi polycounter lvl 16
    Frump wrote: »
    Just scroll up the page a bit ivaj.:)

    hmm, I'm trying to get it to work, maybe I'm missing something. Do I need to load it as a CGFX file? Or is there something else required?

    Because loading it as a CGFX file seems to just cause errors.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    What sort of shader network is involved with making this work? I've got a vague idea of what's happening, but it's /really/ vague. I have neither Max nor Maya, and I'd like to take a crack at getting a Blender version up, assuming that's possible.
  • willy-wilson
    Options
    Offline / Send Message
    willy-wilson polycounter lvl 8
    its an hlsl shder in maya load the plugin in the plugin manager and ur good to go
  • TWilson
    Options
    Offline / Send Message
    TWilson polycounter lvl 18
    Tried it out in Maya 2009 with no success.

    "Unrecognised semantic LitSphere on parameter litSphereMap"

    Looks cool though.
  • Fang
    Options
    Offline / Send Message
    Fang polycounter lvl 7
    Thanks for this :\ A real nice holiday gift for everyone at Polycount :)
  • verybad
    Options
    Offline / Send Message
    verybad polycounter lvl 17
    chronic wrote: »
    So as not to leave Maya users out in the cold - a conversion of this very cool shader.
    litSphere.fx

    There IS a Santa Claus!
  • hyrumark
    Options
    Offline / Send Message
    hyrumark polycounter lvl 12
    It's already a stunning shader, adding support for diffuse maps (and specular) would be incredible.

    It looks like someone already has, plus a whole bunch more: http://blog.maginot.eu/index.php?seite=people&people=till&page=mhn1936983709
  • javi
    Options
    Offline / Send Message
    javi polycounter lvl 16
    TWilson wrote: »
    Tried it out in Maya 2009 with no success.

    "Unrecognised semantic LitSphere on parameter litSphereMap"

    Looks cool though.

    Me too, I'm wondering if it has to be Maya 2010?
  • Neox
    Options
    Offline / Send Message
    Neox veteran polycounter
    hyrumark wrote: »
    It looks like someone already has, plus a whole bunch more: http://blog.maginot.eu/index.php?seite=people&people=till&page=mhn1936983709
    lulz thats rollin ;)
  • peppi
    Options
    Offline / Send Message
    peppi polycounter lvl 18
    Great stuff rollin, I didn't know about this one.. and you're not capturing the thread at all :) Charles and I were thinking it'd make more sense to add this litSphere stuff to an existing shader rather than starting to build a flexible shader around it, so this is very cool indeed.
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    Maya users:
    load the plugin hlslShader.mll from you plugin/prefs

    make a hlslShader node in the hypershade, load the *.fx file into the node - change viewport mode to TEXTURED, not high-quality.

    you must use the .fx written up for maya, not the one from the original post, as max and maya have some subtle differences, such as Z vs. Y up
  • BlackulaDZ
    Options
    Offline / Send Message
    this is awesome, thanks a ton! here's a few spheres i made. bleh. daphz1.jpgdaphz2.jpgdaphz3.jpg
  • onionhead_o
    Options
    Offline / Send Message
    onionhead_o polycounter lvl 16
    so the litsphere is view dependent?

    heres one litsphere i made.

    blu_green_litsphere_by_jujikabane.jpg
  • Neox
    Options
    Offline / Send Message
    Neox veteran polycounter
    in mudbox its dependent to the main light in the scene
  • onionhead_o
    Options
    Offline / Send Message
    onionhead_o polycounter lvl 16
    so is it possible to set it to the main light in max?
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    Mudbox's shader must be doing something more complex than what we have going here, because simply making this shader dependent on the light vector will give a very strange and generally undesirable result.
  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    that depends on how you define "making simply dependent on the light vector"
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    The simplest way I see is to have a light-independent sphere image and a light-depedent one and combine those?
  • chronic
    Options
    Offline / Send Message
    chronic polycounter lvl 10
    define 'define'.
    litSphere shading samples a texture based on the view vector, changing the sample vector to a arbitrary 'light vector' will give a different, although generally undesirable effect.

    the problem with expanding this Shading Through Texture concept is that these litSphere images combine various different surface, reflection and light properties in a static form.

    you can do something basic - define 1 light source, with a litSphere (hemisphere) image for the lit side and extrapolate the unlit side - but paint in any rim-light effects and that is essentially adding another light source. painting in any sort of reflections or ambient light also wont work because they will not retain proper orientation independent of the 'light vector'.

    you can get some cool, realistic effects by adding more and more litSpheres into a shader to combine them - but it becomes cumbersome and ruins (in my opinion) the beauty and simplicity of the litSphere concept.

    concept: a single image - painted, sampled, constructed, can define an entire shader. with code that is so simple its almost magical.
  • rollin
    Options
    Offline / Send Message
    rollin polycounter
    I've made it view dependent.. And in general I use it more in form of a sfx or ambient overlay.. its even possible to only influence the rim light colour with it

    but I haven't had much time lately to mess around with it a bit more
  • arrangemonk
    Options
    Offline / Send Message
    arrangemonk polycounter lvl 15
    this shader projects the coordinates of the texels to cameraspace and simply using the light als source for the vecotr instead of the camera does the half job (backfaces)
  • DEElekgolo
    Options
    Offline / Send Message
    DEElekgolo interpolator
    I made a nice vector for making lit spheres.
    bluew.png
    73210580.jpg
    Here are the illustrator files.
    It uses CS4.
  • Necromantique
    Options
    Offline / Send Message
    It's amazing how much cool stuff people came up with with just a simple shader like this :). After all the reactions on this shader I decided I should sign up here and offer some follow up... (some of them have been partially answered before though)

    1) The current max shader peppi posted transforms the normals into view space (EEEK I only noticed now that my comment actually mentions world space...) the XY axes of the normal are then used to look up into the sphere texture.

    2) The mudbox shader works differently, it transforms the normals into the "active" light's space. BUT! The default light in mudbox is attached to the camera basically causing a similar effect as (1). The only thing is that this way you can add an extra "offset" rotation to the sphere. However, if you make the light shine from an angle aproximately orthogonal to the camera you'll get to see mainly the rim and the effect just isn't too usefull that way.

    3) It is possible to attach the litsphere to a light that is not attached to the camera but then you get the problem what to do when the camera looks in the direction of the light and sees the "back side" of the sphere... (besides the rim problem from (2) )probably using the front side as the back sides will give visually the best results... (check it out in mudbox by unchecking the attach to camera...)

    4) About diffuse maps, specular maps, .... litspheres are so simple they are basically "all in 1" so it is light positions, light colors, diffuse color, specular color, ... all baked into one map. This makes for very few things to set up to get a certain effect although they limit the whole object to use the same material properties.
    Through various artistic hacks you could make it work with other maps. My first try would be to have two litspheres a diffuse/ambient one and a specular one and then do:

    diffuse_map * diff_sphere + specular_map * spec_sphere

    But there are literally 100's of ways to add litspheres to existing materials. (e.g. Check out rollins very cool NPR material... :poly121:)
  • fearian
    Options
    Offline / Send Message
    fearian greentooth
    Hey Its about time this thread got bumped again for anyone that missed it, and I made this matcap for somethign I was working on and thought Id share it.

    5cad3098d01a8d232b753acad6f39972.jpg
  • kdm3d
    Options
    Offline / Send Message
    Tiros wrote: »
    Done aaaaand done. Congratulations, you won a new mac keyboard with the limited edition testicle skin.

    testicleskin.jpg


    Anyhow, really nice shader, thanks. I just love how I can preview my normalmap on flat surfaces with this shader, while actually modeling. :)

    dude...
  • Millenia
    Options
    Offline / Send Message
    Millenia polycount sponsor
    AWESOME shader - using it with all my high poly work from now on!

    1273343822.jpg

    Here's my quick and dirty sphere if anybody wants to try it out:

    1273334587.jpg
  • Zeller Samuel
    Options
    Offline / Send Message
    Awesomness thread

    I made a blog post about this shader on my wordpress, linked this thread
    I used the Auxpecker maps ! They are awesome ! You need to check them

    http://zellersamuel.wordpress.com/2010/05/07/improve-your-3ds-max-viewport-qualit/

    I wonder if you could extract images from the Zbrush matcaps ? (zmt files) that would be awesome :)

    Here's two examples using the Auxpecker spheres

    rhino_reflections.png?w=600&h=300
    3dsmax_different.png?w=600&h=300
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Zeller : to extract matcaps, just take a screenshot!
    Cool glossy white, nice...
  • Zeller Samuel
    Options
    Offline / Send Message
    Zeller : to extract matcaps, just take a screenshot!
    Cool glossy white, nice...

    Good idea, im gonna try :)
  • fac511
    Options
    Offline / Send Message
    this can be applied with C4D?
  • fac511
    Options
    Offline / Send Message
    can use this with c4d ?
  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Maybe this can be used with C4D Max 3d studio, who knows ?
  • PolyHertz
    Options
    Offline / Send Message
    PolyHertz polycount lvl 666
    Just saw this, and its great! Always liked the simplicity of matcap spheres, and because of Sculptris I've already exported most of the materials I use in zbrush as images can be used with this :)
  • Simmo
    Options
    Offline / Send Message
    Simmo polycounter lvl 12
    Wow just saw this today, really awesome! Saves having to do a setup and everything if you just want to show off some WIPs and things. I love it, lots of fun too :) Thanks
  • fatihG_
    Options
    Offline / Send Message
    fatihG_ polycounter lvl 14
    Hey Guys.

    I made a bunch of litsphere's some time ago.. When I found this thread I thought you peoples might be interested in them.

    Most of these were made by making a material in 3d applying that to a sphere and rendering it.

    Here's an example of a few litspheres.
    example_thumb.png

    Download the .rar here:
    http://www.bb0x.com/mudbox/mudbox_litspheres_v2.rar

    Cheers
  • BradMyers82
    Options
    Offline / Send Message
    BradMyers82 interpolator
    Awesome! Thanks man!
  • Mr_Drayton
    Options
    Offline / Send Message
    Mr_Drayton polycounter lvl 14
    Oooh, this is one fantastique technique to improve a lot the visual appearance of any object! :O
    I used this trick to make some jello balls in Unity Engine, using the Toon Shader! It renders prettymuch the same. :D
  • onionhead_o
    Options
    Offline / Send Message
    onionhead_o polycounter lvl 16
    is there a way to render the material in max somehow. like a hack or something. cuz i heard theres a way to do it in maya
  • Xenobond
    Options
    Offline / Send Message
    Xenobond polycounter lvl 18
    but it in diffuse slot, set material to 100% illum?
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    is there a way to render the material in max somehow. like a hack or something. cuz i heard theres a way to do it in maya

    Just use Ravenslayer's grabviewport script (it's on my shader page) to grab at 5000px wide. Then you can get AA and high resolutions, which i think is the only reason you'd wanna render ?
  • cryrid
    Options
    Offline / Send Message
    cryrid interpolator
    The Maya litspheres shader posted earlier seems to work in some scenes in Softimage. Applying it may result in an instant crash though (I think it might depend on whether or not the scene/mesh already has an image clip).

    Works flawlessly for importing meshes into an existing scene where it works though.
  • onionhead_o
    Options
    Offline / Send Message
    onionhead_o polycounter lvl 16
    thanks xoliul.
  • Jister
    Options
    Offline / Send Message
    Does anyone of you have a script to pull this of in Unity3 engine?
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    is there a way to render the material in max somehow. like a hack or something. cuz i heard theres a way to do it in maya

    using mentalray there's a shader called mip_greyball.
  • Jister
    Options
    Offline / Send Message
    the ones who would be interested using litspheres in Unity. there are two ways.
    1 compiling the sphere textures to simplespheremap. and then use a basic toon shader and drop the simplespheremap in the cubemap slot.
    2 or simple copy this shader.
    found it on unity wiki i believe so props to the guy who wrote this ;)
    Shader "Custom/MatCap Bumped" {
        Properties {
            _Color ("Main Color", Color) = (0.5,0.5,0.5,1)
            _BumpMap ("Bumpmap (RGB)", 2D) = "bump" {}
            _MatCap ("MatCap (RGB)", 2D) = "white" {}
        }
       
        Subshader {
            Tags { "RenderType"="Opaque" }
            Fog { Color [_AddFog] }
           
            Pass {
                Name "BASE"
                Tags { "LightMode" = "Always" }
               
                CGPROGRAM
                    #pragma exclude_renderers xbox360
                    #pragma vertex vert
                    #pragma fragment frag
                    #pragma fragmentoption ARB_fog_exp2
                    #pragma fragmentoption ARB_precision_hint_fastest
                    #include "UnityCG.cginc"
                   
                    struct v2f {
                        float4 pos : SV_POSITION;
                        float2  uv : TEXCOORD0;
                        float3  TtoV0 : TEXCOORD1;
                        float3  TtoV1 : TEXCOORD2;
                    };
                   
                    uniform float4 _BumpMap_ST;
                   
                    v2f vert (appdata_tan v)
                    {
                        v2f o;
                        o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                        o.uv = TRANSFORM_TEX(v.texcoord,_BumpMap);
                       
                        TANGENT_SPACE_ROTATION;
                        o.TtoV0 = mul(rotation, UNITY_MATRIX_IT_MV[0].xyz);
                        o.TtoV1 = mul(rotation, UNITY_MATRIX_IT_MV[1].xyz);
                        return o;
                    }
                   
                    uniform float4 _Color;
                    uniform sampler2D _BumpMap;
                    uniform sampler2D _MatCap;
                   
                    float4 frag (v2f i) : COLOR
                    {
                        float3 normal = UnpackNormal(tex2D(_BumpMap, i.uv));
                        // normal = normalize(normal);
                       
                        half2 vn;
                        vn.x = dot(i.TtoV0, normal);
                        vn.y = dot(i.TtoV1, normal);
                       
                        float4 matcapLookup = tex2D(_MatCap, vn*0.5 + 0.5);
                       
                        matcapLookup.a = 1;
                       
                        return _Color*matcapLookup*2;
                    }
                ENDCG
            }
        }
    }
    
    
  • amisima
    Options
    Offline / Send Message
    amisima polycounter lvl 6
    Hello all,
    This amazing shader doesn't work well on Nitros ( max 2012 ) any ideas / fixes ?
    Thank you for your time.

    Best regards,
    Amis
  • Oiban
    Options
    Offline / Send Message
    Oiban polycounter lvl 6
    Hello all,
    This amazing shader doesn't work well on Nitros ( max 2012 ) any ideas / fixes ?
    Thank you for your time.

    Best regards,
    Amis

    Hey! Amisima, i had the same problem, you can't use nitros and matballz, matballz runs on directX, it's a direct X shader, so if you want to use max 2012 and matballz you will have to change the viewport rendering from Nitros to DirectX (you can do this in customize--->viewport--->configure driver).

    I hope it helps!

    Cheers!
  • cupsster
    Options
    Offline / Send Message
    cupsster polycounter lvl 11
2
Sign In or Register to comment.