Zhihar
Zhihar

Reputation: 1428

gnuplot: 3d chart painted in one color, but with shading effect (as usual 3d model)

Can you tell us how to draw a 3d chart in one color, but with a shading effect?

the use of any pm3d gives color depending on the value of z, which I do not need, and practically (visually) does not give shading

I would like to see the chart drawn as a usual 3d model (as usual 3d editors do)

Now I'm using an option that I'm not happy with:

    set hidden3d
    set pm3d
    set palette rgbformulae 22,13,-31

    splot inputFullPath using 2:1:4 with pm3d notitle

enter image description here

And I would like to see this kind of 3d chart:

enter image description here

Upvotes: 0

Views: 372

Answers (1)

Ethan
Ethan

Reputation: 15118

A simple 3D lighting model with specular highlighting was introduced in gnuplot version 5.2. See help lighting. Here is a paragraph from the documentation and a link to the online demo set.

gnuplot> help lighting

 By default the colors assigned to pm3d objects are not dependent on orientation
 or viewing angle. This state corresponds to `set pm3d nolighting`.
 The command `set pm3d lighting` selects a simple lighting model consisting of a
 single fixed source of illumination contributing 50% of the overall lighting.
 The strength of this light relative to the ambient illumination can be adjusted
 by `set pm3d lighting primary <fraction>`.  Inclusion of specular highlighting
 can be adjusted by setting a fractional contribution:
      set pm3d lighting primary 0.50 specular 0.0   # no highlights
      set pm3d lighting primary 0.50 specular 0.6   # strong highlights

link to lighting demo from online collection

enter image description here

Upvotes: 1

Related Questions