Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Tree model leaves shader

#1
I created tree model and I made leaves tga texture for it (with alpha channel) I got semi-transparent leaves vidable only from one side of the plane!
The leaves are supposed to be fully visable from both sides, with norm and gloss texture. Anyone knows how to make it working properly? Help will be appreciated.
This is a shader:

Code:
textures/map_floating/trees/tree_stem_01
{
    qer_editorimage textures/map_floating/trees/tree_stem_01

    surfaceparm trans
    surfaceparm nonsolid
    surfaceparm nodlight
    surfaceparm nolightmap
    dpglossintensitymod  3
    dpglossexponentmod  4
    q3map_bouncescale 1.25

    polygonOffset
    sort 6
    


    {
        map textures/map_floating/trees/tree_stem_01
        blendFunc filter
        rgbgen identity
    }
}
(all models made are mine)
[Image: tree_transp1.jpg]
Edit: It would be also nice to make these leaves animated (moving slightly sideways, as normal leaves should do) anyone knows how to acomplish it?
Edit2:About plant and rock models: Do you think they would fit Xonotic style? Should I create few modular models for Xonotic? What kind?
Reply

#2
Have you tried cull none?
Reply

#3
[Image: tree_better.jpg]
Its better now, but still not satisfactory, thank you! Now the leaves can be visable from under the tree
Reply

#4
Try a different blend function. For alpha blending, blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
Reply

#5
Thank you very much! As you can see its getting better but its still not fully acceptable. Normal maps on leaves are not displayed and for some reason leaves are brighter then in photoshpo (I think). OH! And you can see strange effect around each leaf (sort of hair)
Here is the effect:
[Image: better.jpg]
As you can see, leaves are definitelly to bright, and thats not because their texture. Can this be caused by blending mode/lightmaps?
And shader for leaves:

textures/map_floating/trees/tree_stem_01
{
qer_editorimage textures/map_floating/trees/tree_stem_01

surfaceparm trans
surfaceparm nonsolid
polygonOffset
cull none


{
map textures/map_floating/trees/tree_stem_01
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
rgbgen identity
}
}
Mabye you happen to know how to make them moving (bobbing slightly)?
EDIT: I think after Im done with this model I will make a tutorial Tongue
Reply

#6
As far as I now, the automatic normal mapping is lost when you create a shader script.
I guess q3map_normalImage would explicitly set one but I've never tried this http://q3map2.robotrenegade.com/docs/sha...ormalImage

I think you can use q3map_lightmapBrightness to dim the lightness
http://q3map2.robotrenegade.com/docs/sha...Brightness

I don't see any artefact but on the screenshot but it could be caused by some aliasing on the alpha channel. Maybe experimenting a bit with the blend function can give better results.

I've seen shaders that make the surface wave a little but I have no direct experience on that, take a look at this http://toolz.nexuizninjaz.com/shader/sha...n3.htm#3.3
Reply

#7
If only netradiant had simple node system most great programes for editing have nowadays... Wink Although Im glad for your help, Melanosuchus but Im currently stuck. I tried quite a few settings but the leaves seem to don't have lightmaps at all and the strange thing around each of them (mabye normal maps cause this) taht still remains. Im not giving up yet, although the time I can afford to invest is quickly draining out Wink
Here are the results:

[Image: nolightmaps.jpg]
And strange effect around the leaf edge
[Image: leaves.jpg]
Reply

#8
For lighting, all it should need is this in the second set of curly braces:

map $lightmap
[Image: 230.jpg]
Reply

#9
Thanks. I will try
Reply

#10
I haven't dealt with these things for quite a while.

Your shader for the leaves is named tree_stem_01, are you sure that you are using the right shaders on the right parts of the model?

As the leaves don't seem to be lightmapped, have you made sure to set "spawnflags 4" on the misc_model?
http://en.wikibooks.org/wiki/Q3Map2/Enti...del_entity

The artefacts seem to be caused by a fur shader. Make sure to turn this off:
http://q3map2.robotrenegade.com/docs/sha...l/fur.html

This basic shader might work better:
Code:
textures/yourmap/leaves
{
    cull none
    surfaceparm alphashadow
    surfaceparm noimpact
    surfaceparm nomarks
    surfaceparm nonsolid
    surfaceparm trans
    {
        map textures/yourmap/leaves.tga
        blendFunc blend
        rgbGen vertex
    }
    {
        map $lightmap
        blendFunc filter
    }
}

I advise against making the leaves move. It will likely cause a severe performance penalty.
For that matter, you might also want to disable lightmaps altogether and only use vertex lighting.

To test performance with different shader settings, you can create a gameplay demo,
and then use the timedemo feature (Menu > Demo > Timedemo) to measure performance differences.
Reply

#11
YAY! We are making progress!Thank you! Thats the shader and screenshot from my lastest attempt (I renamed map and suddenly shader started working (??) I don't get it. Why did I have to rename the map and .shader file? I thought shader doesn't have to have the same name as maps has, right? Mabye not appling changes to shader file name ''told'' game engine that there was no changes to shader itself?
Code:
textures/map_floating/trees/tree_stem_01
{
    qer_editorimage textures/map_floating/trees/tree_stem_01

    surfaceparm trans
    surfaceparm nonsolid
    polygonOffset
    cull none
    {
        map $lightmap
        map textures/map_floating/trees/tree_stem_01
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        rgbgen identity
    }
}
Lightmap sems too dark in some areas. I will remake normal maps and change "rgbgen identity" into "rgbgen vertex" as you adviced, Sev. Also when jumping up into the leaves performance goes down terribly (at least 40 fps decrease) Might be this caused by spawnflags 6 (autoclipping model)?

[Image: kind_of_works.jpg]
I have spawnflags set to 6. Is it okey? One more question: Do I have to rebuild whole level to notice changes in shader in game? Can I just build lightmaps or what?
Reply

#12
(05-04-2014, 09:41 AM)Justin Wrote: Lightmap sems too dark in some areas.
Keep in mind that with "cull none" shaders, the texture is shown on both sides of the surface.
IIRC, this means the same lightmap is shown on the front and back. If the surface faces away from the light,
both sides are dark. Make sure that the surface normals point outwards, or towards the light source.

(05-04-2014, 09:41 AM)Justin Wrote: I will remake normal maps and change "rgbgen identity" into "rgbgen vertex" as you adviced, Sev.
rgbGen vertex doesn't mean what you think it does.
http://q3map2.robotrenegade.com/docs/sha...tml#rgbGen

Make sure to look up the keywords you are using in the Q3Map2 manual:
http://q3map2.robotrenegade.com/docs/sha...tents.html

(05-04-2014, 09:41 AM)Justin Wrote: Also when jumping up into the leaves performance goes down terribly (at least 40 fps decrease) Might be this caused by spawnflags 6 (autoclipping model)?
To quote the Q3Map2 wikibook:

Q3Map2 Wikibook Wrote:Use of Q3Map2 autoclipping for models is only recommended for large models with relatively few triangles in their mesh (i.e. terrain). The Q3Map2 autoclipping algorithm is a bit of a hack, and can hurt in-game performance when used on small, dense models.

I recommend to split the model up into two parts.
The stem can be autoclipped and lightmapped (spawnflags 6).
The leaves however should be nonsolid (spawnflags 4).
Reply

#13
I couldn't hope for more. The current result is satisfactory (for Netradiant stardards at least). The way I did this model, Sev is very low poly. There are huge planes with stem and leaves texture on them so I can not split the model like you mentioned Wink Mapping is neverending learning process and it makes it so exciting!! Im creating some other assets (that not require transparency) and putting them together... We'll see what darkplaces can handle and how much time I can afford on this project. I can't promise anything, but ... I can't promise anything Tongue
Tree screenshot, as a good way to conclude this topic (sorry for bad quality)
[Image: satis1.jpg]
Once again: Thank you all for your help.
Regards,
Justin
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Question [NEEDS INFO] how to make the model smoother? (netradiant) Beylet 2 1,506 06-20-2022, 11:50 PM
Last Post: Beylet
  [NEED HELP] Need old rifle model(solved) Kotangens 8 3,858 08-27-2020, 01:42 AM
Last Post: Kotangens
  [SOLVED] Mortar model missing Dr. Midget 11 7,201 04-30-2017, 11:46 AM
Last Post: martin-t
  [NEED HELP] Player model problem hysik 2 4,014 12-15-2015, 11:35 AM
Last Post: hysik
  [NEEDS INFO] Invisible MinstaGib Model Beagle 5 5,938 06-21-2015, 07:49 PM
Last Post: Beagle
  [SOLVED] Shader fading effect with "alphaGen portal" Maddin 1 3,293 02-08-2015, 02:52 PM
Last Post: Mr. Bougo
  [SOLVED] Missing shader previews / lack of authoritative Netradiant help Greaserpirate 6 7,139 09-17-2013, 01:11 AM
Last Post: Mr. Bougo
  [NEEDS INFO] Failing to fallback when a shader doesn't compile edh 0 2,637 12-17-2012, 05:44 PM
Last Post: edh
  [SOLVED] shader - offsetmapping hutty 5 4,657 08-16-2012, 12:48 PM
Last Post: PinkRobot
  [SOLVED] Force model issues Micha 3 4,315 08-11-2012, 05:31 AM
Last Post: rocknroll237

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-