Using the TwoTexture shader on models

Discussion in 'Mapping Questions & Discussion' started by Unregistered HyperCam 2, Aug 6, 2018.

  1. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    4
    Can you not use any of the twotexture shaders on models?
    The model is rendered correctly once the material shader is set to VertexLitGeneric but if I try switching to any of the TwoTexture shaders, (UnlitTwoTexture, LightmappedTwoTexture, and the possibly non existent despite having been mentioned on this very forum VertexLitTwoTexture) the console is spammed with
    "Material MATERIAL_PATH does not support vertex format used by the mesh (maybe missing fields or mismatched vertex compression?), mesh will not be rendered. Grab a programmer!" as long as the model is in my pvs and the model is not rendered at all.
    I am absolutely sure the problem isn't with the material \ texture being missing because as I've said earlier it works when I use the normal VertexLitGeneric, I've also tried using the $model shader parameter and the $noculling one to no avail. No leaks blah blah blah compile log clean you know the usual.
     
  2. fubarFX

    aa fubarFX The "raw" in "nodraw"

    Messages:
    1,697
    Positive Ratings:
    1,892
    I've used unlittwotexture in previous maps, vaguely remember having this error but don't remember what it was about.
     
  3. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    4
    Welp that sucks. At least there's hope.
     
  4. fubarFX

    aa fubarFX The "raw" in "nodraw"

    Messages:
    1,697
    Positive Ratings:
    1,892
    Here, this vmt has worked for me in the past
    Code:
    "unlittwotexture"
    {
        "$baseTexture" "models\props_occult/river_waves"
        "$texture2" "models\props_occult/river_highlight"
        "$model" "1"
        "$surfaceprop" "nodecal"
        "$additive" 1
    
       
        "$texoffset"    "[0 0]"
        "$texscale" "0.13"
       
        "Proxies"
        {   
            "TextureScroll"
            {
                "texturescrollvar" "$basetexturetransform"
                "texturescrollrate" -.35
                "texturescrollangle" 100
            }
           
            // Translate wave
            "Sine"
            {
                "sinemin" -0.10
                "sinemax" 0.065
                "sineperiod" 5
                "resultVar"    "$texoffset[1]"
            }
           
           
            "TextureTransform"
            {
                "scaleVar" "$texscale"
                "translateVar" "$texoffset"
                "resultVar" "$texture2transform"
            }
           
        }
    }
    Maybe the key is $additive, you may need to define how the two textures interact with each other. Altho I'm not sure what effect you're trying to achieve and additive might not be adequate.
     
  5. Unregistered HyperCam 2

    Unregistered HyperCam 2 L3: Member

    Messages:
    124
    Positive Ratings:
    4
    Does not work either.
    The material is basically a copy of the "dev/dev_tvmonitor1a" material (hl2 directory of tf2) with a different basetexture of course, the only difference is that the basetexture is an animated texture and the material has an added proxy of AnimatedTexture incrementing the basetexture frames because of that.

    Here's the vmt file: (It's used on a modded version of the passtime_tv_screen.mdl (passtime achievement telly screen only where this texture is referenced instead of the screen_off one.)
    Code:
    "unlittwotexture"
    {
        "$baseTexture" "models\asylum\tv\rosen"
        "$texture2" "dev/dev_scanline"
        "$model" "1"
        "$surfaceprop" "glass"
        "$additive" 1
        "$texture2scale" 0
        "$vertexcolor" 1
        "$one"        1
        "$zero"        0
        "$temp"        0
        "$texoffset"    "[0 0]"
        "$texscale"    .25
        "$tex2offset"    "[0 0]"
        "$tex2scale"    0
    
        "$a_b_halfwidth"     0.1
        "$a_b_noise"        0
    
        "$a_s_halfwidth"     0.025
        "$a_s_noise"        0
    
        "$a_t_halfwidth"     0.00
        "$a_threshold"        0.7
    
        "$alpha_bias"        0.2
    
    //
        "$j_b_halfwidth"     2
        "$j_b_noise"        0
    
        "$j_s_halfwidth"     0.05
        "$j_s_noise"        0
    
        "$j_t_halfwidth"     0.25
        "$j_threshold"        3
    
        "$j_basescale"        2
    
    //
        "$xo_b_halfwidth"     0.035
        "$xo_b_noise"        0
    
        "$xo_s_halfwidth"     0.001
        "$xo_s_noise"        0
    
        "$xo_t_halfwidth"     0.0
        "$xo_threshold"        0.1
    
    
    
    
    
      
        "Proxies"
        {  
            "AnimatedTexture"
            {
                "animatedtexturevar"    "$basetexture"
                "animatedtextureframenumvar"    "$frame"
                "animatedtextureframerate"    "20"
            }
    
            "Sine"
            {
                "resultVar" "$color[0]"
                "sineperiod" 1
                "sinemin" .9
                "sinemax" .9
            }
            "Sine"
            {
                "resultVar" "$color[1]"
                "sineperiod" .01
                "sinemin" .9
                "sinemax" 1
            }
    
    
    
    
    //        alpha noise
    
            "GaussianNoise"
            {
                "mean"    "$zero"
                "halfwidth"    "$a_b_halfwidth"
                "resultVar"    "$a_b_noise"
            }
            "Abs"
            {
                "srcVar1"    "$a_b_noise"
                "resultVar"    "$a_b_noise"
            }
            "Subtract"
            {
                "srcvar1"    "$one"
                "srcvar2"    "$a_b_noise"
                "resultvar"    "$a_b_noise"
            }
            "GaussianNoise"
            {
                "mean"    "$zero"
                "halfwidth"    "$a_s_halfwidth"
                "resultVar"    "$a_s_noise"
            }
            "Abs"
            {
                "srcVar1"    "$a_s_noise"
                "resultVar"    "$a_s_noise"
            }
            "Subtract"
            {
                "srcvar1"    "$one"
                "srcvar2"    "$a_s_noise"
                "resultvar"    "$a_s_noise"
            }
            "GaussianNoise"
            {
                "mean"    "$a_threshold"
                "halfwidth"    "$a_t_halfwidth"
                "resultVar"    "$a_threshold"
            }
            "LessOrEqual"
            {
                "srcVar1"    "$a_b_noise"
                "srcVar2"    "$a_threshold"
                "lessEqualVar"    "$a_b_noise"
                "greaterVar"    "$a_s_noise"
                "resultVar"    "$temp"
            }
    
    
    
    //        interlace noise
    
    
            "GaussianNoise"
            {
                "mean"    "$zero"
                "halfwidth"    "$j_b_halfwidth"
                "resultVar"    "$j_b_noise"
            }
            "GaussianNoise"
            {
                "mean"    "$zero"
                "halfwidth"    "$j_s_halfwidth"
                "resultVar"    "$j_s_noise"
            }
            "GaussianNoise"
            {
                "mean"    "$j_threshold"
                "halfwidth"    "$j_t_halfwidth"
                "resultVar"    "$j_threshold"
            }
            "Abs"
            {
                "srcVar1"    "$j_b_noise"
                "resultVar"    "$temp"
            }
            "LessOrEqual"
            {
                "srcVar1"    "$temp"
                "srcVar2"    "$j_threshold"
                "lessEqualVar"    "$j_s_noise"
                "greaterVar"    "$j_b_noise"
                "resultVar"    "$temp"
            }
            "Add"
            {
                "srcvar1"    "$temp"
                "srcvar2"    "$j_basescale"
                "resultvar"    "$tex2scale"
            }
    
    
    
    
    
    
    
    // debug
    //        "Equals"
    //        {
    //            "resultvar"    "$alpha"
    //            "srcvar1"    "$one"
    //        }
    
    
    
            "TextureTransform"
            {
                "translateVar" "$texoffset"
                "resultVar" "$basetexturetransform"
            }
    
    
    //        interlacing
    
    
            "LinearRamp"
            {
                "resultVar" "$tex2offset[1]"
                "rate" -.91
            }
    
            "TextureTransform"
            {
    //            "scaleVar"    "$tex2scale"
                "translateVar"    "$tex2offset"
                "resultVar"    "$texture2transform"
            }
        }
    
          
    }
     
    Last edited: Aug 7, 2018