How can you plot a finer mesh like at noninteger values or something? My function is defined for only a very narrow range and Id like to visualize it better with the mesh. Also how do you make the function white? There is no "White" ColorData.
Your color question:
The default color is white for plots, with different colored lighting being used by default to make the plot appear non-white.
You can use the Lighting option (Lighting -> "Neutral") to get non-colored lighting in 3D plots. Then the result is white/grayscale:
Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}, Lighting -> "Neutral"]
Your mesh question:
More information or an example is needed to answer this question. But try examining the PlotPoints option in the documentation to start.
Related
I’m using a RenderTarget in three.js/react-three-fiber to generate a simple alpha map using a Cylinder. The Cylinder uses a basic material with color white, which should be fully opaque in the alpha map, per the docs. However, when applied to a geometry, the area corresponding to white in the mask is not fully opaque, as shown in this example:
https://codesandbox.io/s/r3f-programmatic-alpha-map-f8lhi?file=%2Fsrc%2Findex.js
The scene setup is:
Red plane masked to a cylinder via the alpha mask - expected to be fully opaque
Behind that, a white box - it should not be visible at all from default camera position, but it is.
Does anyone have any idea why the white alpha mask leaves the Red plane with non-zero transparency (i.e. NOT fully opaque)? Thank you.
The explanation was provided by #drcmda here: there is a default tone mapping applied by react-three-fiber which results in the alpha map not being rendered pure white. To prevent that happening, disable tone mapping in the alpha map geometry material:
<Cylinder args={[1, 1, 1, 64]} position={[0, 0, 0]} rotation={[Math.PI / 2, 0, 0]}>
<meshBasicMaterial attach="material" color="white" toneMapped={false} />
</Cylinder>
i.e. in line 49 of the codesandbox linked in the question.
Please look at this 3D scene: (the link became obsolete)
The curve is made of multiple (1092) short THREE.Line objects.
This curve, the ball (THREE.SphereGeometry) and the sod (THREE.CubeGeometry) are nested in THREE.Object3D which I am rotating using rotation.x and rotation.y properties.
The problem is that the curve sometimes is merged into the sod or visible through an opposite side of it although the curve actually "hangs" above the sod.
What you are seeing is an artifact of CanvasRenderer. The best you can do is tessellate your geometry. For example,
THREE.CubeGeometry( 50, 3, 50, 4, 1, 4 );
three.js r.58
Please see this MWE:
Plot[x, {x, -1, 1}, Frame -> True]
There is one horizontal and one vertical line drawn that crosses zero - how do I remove these lines? I tried GridLines->None, but that did not work.
Ever the rep-whore, here's my original comment made into an answer:
try adding Axes->False to the options in your Plot command.
I have a 6 vertex rectangle 100x100 in size, this i covered with a 100x100 background image. now i would like to render two "sub textures" on top of it.
lets say i have two sub textures size 20x20 one of then i like to position at x:10 y:10 and the other x:50 and y:50
(these are actually to get used as masks on the background image.)
how should i go with this ? my first thought was to send a uniform vec2 with the position of the two sub textures info the fragment shader, but i cant really figure out how to convert those into texture2d(subtexture, coordinate) because texture2d takes 0-1 values. i cant really wrap my head around this, and i hope to get some pointers in what direction i should go.
(this is to be used on OpenGL ES 2.0)
Then I think what you're really looking for is how to update a texture. In you case, the simplest method may be to use glTexSubImage2D. The following will do what you ask in your original post
glTexSubImage2D( GL_TEXTURE_2D, 0, 10, 10, 20, 20, <format>, <type>, <subimage1> );
glTexSubImage2D( GL_TEXTURE_2D, 0, 50, 50, 20, 20, <format>, <type>, <subimage2> );
where <format>, and <type> describe the pixels in the sub-texture stored at <subimage*>. There are quite a lot of additional answers in other questions; just search for glTexSubImage2D.
A more complex method (for when things aren't as simple as your problem) is to use framebuffer objects to render to textures (have search for that one too, if you need).
I have a 3D surface created by the ListPlot3D in mathematica. The surface itself is relatively planar and in the arbitrary plane xy. I would like to place this surface on top of a molecule either generated from the ChemicalData function or inputted from a .pdb or other molecule input. This molecule is also planar and placed again the in the xy plane. I would like these two 3D objects to be separated by some z distance.
The end hope is that I will have a potential energy surface placed above this planar molecule that will still be rotatable in 3D. I have been using the Show and Graphics 3D options to no success. The x,y points on the surface correspond to x,y points on the 3D molecule, however they can easily be scaled and shifted as needed. As an option of last resort I suppose I could input the x,y,z coordinates of the atoms and use the PointListPlot3D command with various options to mimic the look of the molecule but this seems to be much more complicated then it needs to be.
Another approach that could be possible is if both of the 3D objects are converted to 3D boxes and simply stacked on top of each other. However I have not found this functionality as of yet in mathematica. Does anyone have any ideas on how to do this?
PES = ListPlot3D[{{0., 0., -2.04900365`},..., {0., 0.3, -2.05743098`}}]
Show[Graphics3D[ChemicalData["Benzene","MoleculePlot"]],PES]
The issue was the scale of the molecule versus the scale of the energy surface.
The units, as best I can tell, are in picometers. However their atomic distance seem to be off by 3%.
As an update to this it became much simpler to take the xyz coordinate of the molecule and hand generate the objects. It has been some time but I believe if you only state:
ChemicalData["Benzene","MoleculePlot"]
Mathematica will show you the format. If you do many of these a fairly simple python script can be made.
What Szabolcs said and I also did not get from your question why wouldn't something like this work?
Show[Graphics3D[
Rotate[ChemicalData["Caffeine", "MoleculePlot"][[1]],
45 Degree, {1, .5, 0}]],
Plot3D[-200 + 50 Sin[x*y/10000], {x, -100 Sqrt[3*Pi],
100 Sqrt[3*Pi]}, {y, -100 Sqrt[3*Pi], 100 Sqrt[3*Pi]},
ColorFunction -> "TemperatureMap"], Axes -> True]
ListPlot3D returns a Graphics3D object, so you should be able to combine it with other Graphics3D objects...
lp = ListPlot3D[ RandomReal[{}, {50, 3}], Mesh -> None];
sp = Graphics3D[Sphere[]];
Show[sp, lp, Boxed -> False]
although getting everything the same size will be the challenge...