3D Lighting & Shading with TikZ/PGFPlotsHow to use Tikz shade command in order to achieve 3D like...

Why can I easily sing or whistle a tune I've just heard, but not as easily reproduce it on an instrument?

How can I improve my fireworks photography?

Why do members of Congress in committee hearings ask witnesses the same question multiple times?

Finding the number of integers that are a square and a cube at the same time

What's a good word to describe a public place that looks like it wouldn't be rough?

What is better: yes / no radio, or simple checkbox?

Counting monomials in skew-symmetric+diagonal matrices

How to define a macro with multiple optional parameters?

How would an AI self awareness kill switch work?

Wanted: 5.25 floppy to usb adapter

How to approximate rolls for potions of healing using only d6's?

Why didn't Eru and/or the Valar intervene when Sauron corrupted Númenor?

How Should I Define/Declare String Constants

What is the purpose of easy combat scenarios that don't need resource expenditure?

Criticizing long fiction. How is it different from short?

Predict mars robot position

Do authors have to be politically correct in article-writing?

Is the theory of the category of topological spaces computable?

Crystal compensation for temp and voltage

Why is this code uniquely decodable?

Am I a Rude Number?

What happens if a wizard reaches level 20 but has no 3rd-level spells that they can use with the Signature Spells feature?

Auto Insert date into Notepad

Which aircraft had such a luxurious-looking navigator's station?



3D Lighting & Shading with TikZ/PGFPlots


How to use Tikz shade command in order to achieve 3D like resultsPolyline shading in TikZMore on “Cylinder shading with pgf TiKZ”TikZ: drawing 3 intersecting circles and shadingShading in TikZ calendarDrawing a box with shading in pgfplotsHalftone shading with TikZPeriodic shading in tikzHow to make a longitudinal sine wave shading with pgfplots?How to do logarithmic shading with TikZ?Tikz shading Issues













1















I'm trying to shade 3D parametric surfaces using a basic 3D lighting model, but this answer says that TikZ has no support for lighting. The only option is to use color gradients to shade vertices. This may be acceptable for certain graphs, but not when you're trying to show the actual shape of a 3D object.



But TikZ clearly has all the data available to do this, though. Derivatives can be calculated numerically for each vertex (i.e. without the user needing to analytically derive them by hand for each surface). These can then be use to construct the normals. Let the user specify a point light location and presto, you have diffuse lighting. Snag the camera position and you have specular lighting as well.



I know that packages like Asymptote can create nice 3D images, but these solutions create raster graphics, and I need vector graphics.



How can I add 3D lighting and shading to TikZ? Is there a reason it doesn't exist already? I don't know how TikZ is implemented, and I haven't written any extensions before, so I have no idea how I would add this feature.










share|improve this question







New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Welcome to TeX-SE. It is true that TikZ has all the data necessary to compute a realistic shading in principle. However, realizing this in practice is a very different story. Even though automatically hiding hidden surfaces is an in principle solved problem, realizing it in practice is tough. That's why asymptote is not super short package. And asymptote does allow you to produce 3d vector graphics, see p. 55 of this nice tutorial, albeit with limitations.

    – marmot
    11 hours ago











  • You might be able to use Sage combined with the sagetex package. Sage documentation here gives examples with 3D and lighting and parametric. You can see what code looks like by going here, copying and pasting code samples. Images can be saved as svg. Try code, for example, of " 4 spheres that illustrates various uses of the texture command". Worth mentioning Sage should be able to do the math you talk about and work into the tikzpicture.

    – DJP
    6 hours ago


















1















I'm trying to shade 3D parametric surfaces using a basic 3D lighting model, but this answer says that TikZ has no support for lighting. The only option is to use color gradients to shade vertices. This may be acceptable for certain graphs, but not when you're trying to show the actual shape of a 3D object.



But TikZ clearly has all the data available to do this, though. Derivatives can be calculated numerically for each vertex (i.e. without the user needing to analytically derive them by hand for each surface). These can then be use to construct the normals. Let the user specify a point light location and presto, you have diffuse lighting. Snag the camera position and you have specular lighting as well.



I know that packages like Asymptote can create nice 3D images, but these solutions create raster graphics, and I need vector graphics.



How can I add 3D lighting and shading to TikZ? Is there a reason it doesn't exist already? I don't know how TikZ is implemented, and I haven't written any extensions before, so I have no idea how I would add this feature.










share|improve this question







New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Welcome to TeX-SE. It is true that TikZ has all the data necessary to compute a realistic shading in principle. However, realizing this in practice is a very different story. Even though automatically hiding hidden surfaces is an in principle solved problem, realizing it in practice is tough. That's why asymptote is not super short package. And asymptote does allow you to produce 3d vector graphics, see p. 55 of this nice tutorial, albeit with limitations.

    – marmot
    11 hours ago











  • You might be able to use Sage combined with the sagetex package. Sage documentation here gives examples with 3D and lighting and parametric. You can see what code looks like by going here, copying and pasting code samples. Images can be saved as svg. Try code, for example, of " 4 spheres that illustrates various uses of the texture command". Worth mentioning Sage should be able to do the math you talk about and work into the tikzpicture.

    – DJP
    6 hours ago
















1












1








1








I'm trying to shade 3D parametric surfaces using a basic 3D lighting model, but this answer says that TikZ has no support for lighting. The only option is to use color gradients to shade vertices. This may be acceptable for certain graphs, but not when you're trying to show the actual shape of a 3D object.



But TikZ clearly has all the data available to do this, though. Derivatives can be calculated numerically for each vertex (i.e. without the user needing to analytically derive them by hand for each surface). These can then be use to construct the normals. Let the user specify a point light location and presto, you have diffuse lighting. Snag the camera position and you have specular lighting as well.



I know that packages like Asymptote can create nice 3D images, but these solutions create raster graphics, and I need vector graphics.



How can I add 3D lighting and shading to TikZ? Is there a reason it doesn't exist already? I don't know how TikZ is implemented, and I haven't written any extensions before, so I have no idea how I would add this feature.










share|improve this question







New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm trying to shade 3D parametric surfaces using a basic 3D lighting model, but this answer says that TikZ has no support for lighting. The only option is to use color gradients to shade vertices. This may be acceptable for certain graphs, but not when you're trying to show the actual shape of a 3D object.



But TikZ clearly has all the data available to do this, though. Derivatives can be calculated numerically for each vertex (i.e. without the user needing to analytically derive them by hand for each surface). These can then be use to construct the normals. Let the user specify a point light location and presto, you have diffuse lighting. Snag the camera position and you have specular lighting as well.



I know that packages like Asymptote can create nice 3D images, but these solutions create raster graphics, and I need vector graphics.



How can I add 3D lighting and shading to TikZ? Is there a reason it doesn't exist already? I don't know how TikZ is implemented, and I haven't written any extensions before, so I have no idea how I would add this feature.







tikz-pgf pgfplots 3d shading






share|improve this question







New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 11 hours ago









GraphicsMuncherGraphicsMuncher

1062




1062




New contributor




GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






GraphicsMuncher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Welcome to TeX-SE. It is true that TikZ has all the data necessary to compute a realistic shading in principle. However, realizing this in practice is a very different story. Even though automatically hiding hidden surfaces is an in principle solved problem, realizing it in practice is tough. That's why asymptote is not super short package. And asymptote does allow you to produce 3d vector graphics, see p. 55 of this nice tutorial, albeit with limitations.

    – marmot
    11 hours ago











  • You might be able to use Sage combined with the sagetex package. Sage documentation here gives examples with 3D and lighting and parametric. You can see what code looks like by going here, copying and pasting code samples. Images can be saved as svg. Try code, for example, of " 4 spheres that illustrates various uses of the texture command". Worth mentioning Sage should be able to do the math you talk about and work into the tikzpicture.

    – DJP
    6 hours ago





















  • Welcome to TeX-SE. It is true that TikZ has all the data necessary to compute a realistic shading in principle. However, realizing this in practice is a very different story. Even though automatically hiding hidden surfaces is an in principle solved problem, realizing it in practice is tough. That's why asymptote is not super short package. And asymptote does allow you to produce 3d vector graphics, see p. 55 of this nice tutorial, albeit with limitations.

    – marmot
    11 hours ago











  • You might be able to use Sage combined with the sagetex package. Sage documentation here gives examples with 3D and lighting and parametric. You can see what code looks like by going here, copying and pasting code samples. Images can be saved as svg. Try code, for example, of " 4 spheres that illustrates various uses of the texture command". Worth mentioning Sage should be able to do the math you talk about and work into the tikzpicture.

    – DJP
    6 hours ago



















Welcome to TeX-SE. It is true that TikZ has all the data necessary to compute a realistic shading in principle. However, realizing this in practice is a very different story. Even though automatically hiding hidden surfaces is an in principle solved problem, realizing it in practice is tough. That's why asymptote is not super short package. And asymptote does allow you to produce 3d vector graphics, see p. 55 of this nice tutorial, albeit with limitations.

– marmot
11 hours ago





Welcome to TeX-SE. It is true that TikZ has all the data necessary to compute a realistic shading in principle. However, realizing this in practice is a very different story. Even though automatically hiding hidden surfaces is an in principle solved problem, realizing it in practice is tough. That's why asymptote is not super short package. And asymptote does allow you to produce 3d vector graphics, see p. 55 of this nice tutorial, albeit with limitations.

– marmot
11 hours ago













You might be able to use Sage combined with the sagetex package. Sage documentation here gives examples with 3D and lighting and parametric. You can see what code looks like by going here, copying and pasting code samples. Images can be saved as svg. Try code, for example, of " 4 spheres that illustrates various uses of the texture command". Worth mentioning Sage should be able to do the math you talk about and work into the tikzpicture.

– DJP
6 hours ago







You might be able to use Sage combined with the sagetex package. Sage documentation here gives examples with 3D and lighting and parametric. You can see what code looks like by going here, copying and pasting code samples. Images can be saved as svg. Try code, for example, of " 4 spheres that illustrates various uses of the texture command". Worth mentioning Sage should be able to do the math you talk about and work into the tikzpicture.

– DJP
6 hours ago












0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






GraphicsMuncher is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477584%2f3d-lighting-shading-with-tikz-pgfplots%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








GraphicsMuncher is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















GraphicsMuncher is a new contributor. Be nice, and check out our Code of Conduct.













GraphicsMuncher is a new contributor. Be nice, and check out our Code of Conduct.












GraphicsMuncher is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477584%2f3d-lighting-shading-with-tikz-pgfplots%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...

Castillo d'Acher Características Menú de navegación