Spark AR Studio: Is it possible to get the color of a screen pixel from script? - spark-ar-studio

For the effect I want to create, I need to get pixel color information from the screen texture.
The texture sampler patch doesn't do it for me because I want to sample many points and I also didn't find a way to send its output to the script (Output is ShaderGeneric, which I can't convert to an accepted "To-script" parameter).
Is the texture data somehow accessible via code? TextureBase contains a signal field, which returns a ShaderSignal. What is that? Does it contain texture data? I couldn't find clarifying documentation on it.
It would be awesome if someone could help me with this!

No it is not possible. The texture data is stored on the GPU, and there is no way in Spark to read this data from the GPU to the CPU for scripting purposes.

I met the same problem and then realized that it is not necessary to use patch editor to send inputs to script. It can get data directly by loading modules. For example: https://sparkar.facebook.com/ar-studio/learn/documentation/reference/classes/texturesmodule/
Hope it will work with you.

Related

How to write a configuration file to tell the AllenNLP trainer to randomly split dataset into train and dev

The official document of AllenNLP suggests specifying "validation_data_path" in the configuration file, but what if one wants to construct a dataset from a single source and then randomly split it into train and validation datasets with a given ratio?
Does AllenNLP support this? I would greatly appreciate your comments.
AllenNLP does not have this functionality yet, but we are working on some stuff to get there.
In the meantime, here is how I did it for the VQAv2 reader: https://github.com/allenai/allennlp-models/blob/main/allennlp_models/vision/dataset_readers/vqav2.py#L354
This reader supports Python slicing syntax where you, for example, specify a data_path as "my_source_file[:1000]" to take the first 1000 instances from my_source_file. You can also supply multiple paths by setting data_path: ["file1", "file2[:1000]", "file3[1000-"]]. You can probably steal the top two blocks in that file (line 354 to 369) and put them into your own dataset reader to achieve the same result.

Convert and add obj model to Web gl scene - without three.js

I want someone to tell me the steps to follow to convert an .obj object to json object so I can add it to my web gl scene like this : http://learningwebgl.com/blog/?p=1658
I ve tried everything. Python script, online converters etc. Every one has its flaws and I can't fix them.
I don't use the three.js lib.
Why can't you fix them?
There is no simple answer for how. The format for .obj is documented here. Read it, pull the data out you want in a format you design.
There's an infinite number of ways to convert it and an infinite number of ways to store the data. Maybe you'd like to read out the data and store the vertices in JavaScript arrays. Maybe you'd like to store them in binary which you download with XHR. Maybe you'd like to apply lossy compression to them so they download faster. Maybe you'd like to split the vertices when they reach some limit. Maybe you'd like to throw away texture coordinates because your app doesn't need them. Maybe you'd like to read higher order definitions and tessellate them into triangles. Maybe you'd like to read only some of the material parameters because you don't support all of them. Maybe you'd like to split the vertices by materials so you can more easily handle geometries with multiple materials. Maybe you'd like to reindex them so you can use gl.drawElements or maybe you'd like to flatten them so you can use gl.drawArrays.
The question you're asking is far too broad.

Convert Jupiter Tessellation(JT) files to JSON to render in THREE.js

How do I render .JT files in THREE.js? I checked following options and could not get anything to proceed with:
checked in Three.js on different loaders which are available - didn't get loader for JT files. Please let me know if there is anything already present which I am missing in three.js.
http://www.johannes-raida.de/jnetcad.htm - if I have to write my own conversion method, at this of point, not sure how to proceed with. any pointer will be helpful
Any help or pointers will be appriciated.
Thanks in advance,
Pradeep
JNetCAD won't help you a huge amount unless you write it as a web service. Its Java (server side code) while three.js is client side. If you wanted to go down this route though, you could create a small RESTful web service that took a .JT file as input and returned the converted JSON. This does require a fair amount of Java knowledge though.
Unless you specifically need on-the-fly transformation, you're probably going to find it a lot easier to just run the .JT file through the tool yourself and work directly from a supported format. This is what they have done on the JNetCAD web page to good effect.

How to read target extent from a huge TIFF file by LibTiff.Net library

I have a big tiff file which I don't want to load it into memory one time (That will cause my application takes so many memory), I want to load target part of it one time and show this part in screen.
I am trying to use LibTiff.net library for implement this, but I haven't found a suitable API for it.
Currently I can just load that by calloc a new array (very big!) then call ReadRGBAImageOriented function for load the RGBA value for it.
Do someone have experience on it?
Thanks

what is the most efficient and safe method to save a short array on html?

I'm trying to make a website to serve as the interface between a plotting program and the user input file. The plotting program needs several parameters, which I could allow the user to enter using input tag. But the plotting program needs user input on the legend for distinguishing the values in the input file as well, namely the range(boundary) of value and the corresponding color for this range. I made a fieldset containing the required input elements for one range. When user click "Add another range", the content of the fieldset is cleared so as to be ready for the new input. And the previously entered input is stored in a table below as a new row. Beside this row, there is a "delete" button.
As this website is aimed for multiple users, this information should be also exclusive for the corresponding user. Could someone please tell me what approach should I use? The plotting program is written using perl, and I'm using CGI for this website.
And this approach should allow the html part to access the current values in the array, so I could display the entered ranges in the table dynamically. This approach should also allow the deletion/modification/addition of such entered range information. i'm thinking of a temporary database. But I only need the final version of all the range info in a string, so I can send it to the CGI program and organize it to be the correct format to be inputted into the perl plotting program.
Any help or hint is greatly appreciated! I'm a newbie to this area. Thank you very much for your time and help in advance!
JSON is pretty universal these days. Use that. Many new database systems like MongoDB use JSON as a native storage format.
Most server-side languages can consume and produce JSON easily. JSON allows structured data, so it can do more than simple arrays.
JSON is also very fast on the browser (compared to XML), being a native JavaScript object.
If the data will be purely in Perl, then FreezeThaw or Storable are the things to use. If your data is simple, then there is nothing wrong with Diodeus' answer of using JSON, but as things get complicated, those modules will be able to handle the complexities of Perl datastructures better.