Stream: brlcad

Topic: Appleseed


view this post on Zulip Rahil Malik (Jan 07 2018 at 20:00):

Shall i share the .appleseed file for you guys to review if its done now ?

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:02):

I am doing the appleseed taks #1 of 5

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:10):

can someone help ?

view this post on Zulip Mahdi (Jan 07 2018 at 20:11):

What do you need help with?

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:11):

i have taken that appleseed #1 of 5 task

view this post on Zulip Mahdi (Jan 07 2018 at 20:12):

I was going to send you a link to my blog post but I'm suspended for some reason :(

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:14):

its almost done, but i was told to create an EDF, and i did so

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:14):

i dont remeber how but i binded the EDF to camera and i want to knwo if i can share the .appleseed file here in public

view this post on Zulip Sean (Jan 07 2018 at 20:15):

sure you can, so long as everyone does their own work

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:16):

AppleSeedProject.appleseed

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:16):

here, so have i done my task ?

view this post on Zulip Sean (Jan 07 2018 at 20:17):

does ray tracing work?

view this post on Zulip Sean (Jan 07 2018 at 20:17):

you get a black window if it's not working

view this post on Zulip Sean (Jan 07 2018 at 20:17):

you see a sphere if it's right

view this post on Zulip Sean (Jan 07 2018 at 20:17):

or whatever you import via obj

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:18):

i see a pink sphere

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:19):

and i imported a sphere , i converted a .g file to .obj and imported it in appleseed , the made an instance of it . and Now i can successfully see my sphere

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:21):

so i did the EDF step correctly ?

view this post on Zulip Sean (Jan 07 2018 at 20:31):

doesn't sound like it

view this post on Zulip Sean (Jan 07 2018 at 20:32):

did you try the render option up on the menu?

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:34):

Yes

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:34):

did you try the render option up on the menu?

Yes , and it showed me the pink sphere

view this post on Zulip Rahil Malik (Jan 07 2018 at 20:35):

the Camera doesn't have any way to get binded to any stuff of environment

view this post on Zulip Mahdi (Jan 07 2018 at 20:36):

Speaking of appleseed, has anyone managed to create that plugin yet?

view this post on Zulip Sean (Jan 07 2018 at 20:39):

@Mahdi no, not even progress I think

view this post on Zulip Sean (Jan 07 2018 at 20:39):

it's hard but didn't hear any questions

view this post on Zulip Sean (Jan 07 2018 at 20:39):

@Rahil Malik did you create an environment edf?

view this post on Zulip Sean (Jan 07 2018 at 20:40):

then next edit your environment and bind it

view this post on Zulip Mahdi (Jan 07 2018 at 20:44):

I really wanted an afternoon to hack on that but I still can't get the sources working on my windows machine. Running linux on a vm and installing all the sources there would probably be my next move.

view this post on Zulip Sean (Jan 07 2018 at 20:45):

there's not enough time now, but if someone had spent the entire GCI just working on appleseed integration tasks, they probably would have won :)

view this post on Zulip Sean (Jan 07 2018 at 20:45):

as it is, I think everyone got stuck on the last task -- which was hard, but couldn't figure out a way to break it up better

view this post on Zulip caleb parks (Jan 07 2018 at 20:50):

I had a hard time doing the first appleseed task because the mac version is not working in anything after version 1.8

view this post on Zulip Mahdi (Jan 07 2018 at 20:51):

Are there any tasks that could be done in a couple days and would be considered highly rewarding?

view this post on Zulip Rahil Malik (Jan 08 2018 at 00:56):

@Sean yes i binded the edf toh the environment. Then ?

view this post on Zulip Mahdi (Jan 08 2018 at 01:33):

I think what you've done is technically enough for the task

view this post on Zulip Rahil Malik (Jan 08 2018 at 02:29):

are you sure ? , Thank You !

view this post on Zulip Rahil Malik (Jan 08 2018 at 02:30):

you can see the file and tell me?

view this post on Zulip Sean (Jan 08 2018 at 03:18):

@Sean yes i binded the edf toh the environment. Then ?

I think that's it -- what happens if you tell it to raytrace?

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:22):

the pink sphere is rendered

view this post on Zulip Sean (Jan 08 2018 at 03:23):

what do you mean? does it render pink or does it show a sphere

view this post on Zulip Sean (Jan 08 2018 at 03:23):

screenshot!

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:23):

a sphere appears
AppleSeedss.PNG AppleSeed.PNG

view this post on Zulip Sean (Jan 08 2018 at 03:24):

so that's still not right

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:24):

the first screenshot only not the second one

view this post on Zulip Sean (Jan 08 2018 at 03:24):

by chance, did you turn on one of the debug modes?

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:25):

nope

view this post on Zulip Sean (Jan 08 2018 at 03:25):

Diagnostics->Override Shader is set to what?

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:25):

what is missing then ? , wil creating a new project do it

view this post on Zulip Sean (Jan 08 2018 at 03:26):

trying to figure out what's wrong

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:26):

Diagnostics->Override Shader is set to what?

no override

view this post on Zulip Sean (Jan 08 2018 at 03:26):

k, that's good

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:27):

so, pink color is not good ? it shouldn''t been there ?

view this post on Zulip Sean (Jan 08 2018 at 03:27):

of course not .. does that look nice to you? :)

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:28):

From the first pointt tried it was like this so i ont know the difference

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:29):

can you send me screenshot of how it should look like ?

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:30):

i have appleseed 1.8.0-beta

view this post on Zulip Sean (Jan 08 2018 at 03:32):

I deleted my test setup, but let me see if I can recreate it

view this post on Zulip Sean (Jan 08 2018 at 03:32):

it should simply look like a rendered sph. that's pink to tell you that something isn't set up right

view this post on Zulip Sean (Jan 08 2018 at 03:32):

oh wait, did you set a material on it?

view this post on Zulip Sean (Jan 08 2018 at 03:33):

on the object instance

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:33):

no

view this post on Zulip Sean (Jan 08 2018 at 03:33):

that's probably the problem

view this post on Zulip Sean (Jan 08 2018 at 03:34):

it's pink because you've not told it what it should look like, what material it is

view this post on Zulip Sean (Jan 08 2018 at 03:34):

just set one of the defaults like the disney material

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:34):

i actually created another prject and as soon as i import the object , the object instance is made and its there on th screen when i rendeer it

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:34):

that's probably the problem

OKay

view this post on Zulip Sean (Jan 08 2018 at 03:35):

what's it look like?

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:36):

done,

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:36):

donehere.PNG

view this post on Zulip Sean (Jan 08 2018 at 03:36):

there ya go

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:37):

THANK YOU sooo much

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:37):

so relieved

view this post on Zulip Rahil Malik (Jan 08 2018 at 03:38):

as its done, i have uploaded it on code-in and submitted :thumbs_up:

view this post on Zulip Sean (Jan 19 2018 at 05:17):

@Mitesh I see that franz explained the same to you about plugins a couple days ago

view this post on Zulip Mitesh (Jan 19 2018 at 07:56):

ya I had a talk with him...but now i have understood little more...

view this post on Zulip Jeff Sieu (Jan 19 2018 at 08:02):

I guess since GCI is sort of over, I'll use this stream instead.

view this post on Zulip Jeff Sieu (Jan 19 2018 at 08:02):

appleseedplugin.zip

view this post on Zulip Jeff Sieu (Jan 19 2018 at 08:04):

pluginerror.txt
This does not work without crashing Appleseed upon Rendering though.
The above error is returned (for me at least).

view this post on Zulip Mitesh (Jan 19 2018 at 08:06):

@Jeff Sieu which system do you use?

view this post on Zulip Jeff Sieu (Jan 19 2018 at 08:13):

Ubuntu 16.04

view this post on Zulip Mitesh (Jan 19 2018 at 08:14):

oh I see... I have windows 10... anyways...thanks

view this post on Zulip Sean (Jan 19 2018 at 17:59):

aha @Jeff Sieu ... at a quick glance at that error log, I'd say you don't have resources initialized

view this post on Zulip Sean (Jan 19 2018 at 18:08):

you'll need to create an array of resources: struct resource[MAX_CPUS] = {0};

view this post on Zulip Sean (Jan 19 2018 at 18:09):

call rt_resource_init() on each

view this post on Zulip Sean (Jan 19 2018 at 18:09):

then making sure each rt_shootray() not only passes one, but is passed the right one for a given thread

view this post on Zulip Sean (Jan 19 2018 at 18:10):

you'l have to figure out a way to determine which thread you are when the plugin is running

view this post on Zulip Mitesh (Jan 20 2018 at 01:38):

I couldn't use that plugin since i have windows...
But as @Sean suggested i removed all the code and tried adding printf(""); the build was sucessfull and also appleseed ran successfully....later on I again tried writing out file in which the hello world text is displayed(as I did in appleseed #3). and file was successfully loaded out.

view this post on Zulip Mitesh (Jan 20 2018 at 01:40):

@Jeff Sieu i saw you have included tcl libraries which i haven't maybe that's what causing the problem....

view this post on Zulip Jeff Sieu (Jan 20 2018 at 02:43):

@Sean i think I did that though, I initialised 100 resources and used bu_parallel_id to find out which cpu was being used

view this post on Zulip Jeff Sieu (Jan 20 2018 at 02:43):

Or maybe I accidentally removed that part while trying things

view this post on Zulip Jeff Sieu (Jan 20 2018 at 02:49):

Is using ap->a_resource = resource[cpu] the right way to do it?

view this post on Zulip Jeff Sieu (Jan 20 2018 at 03:07):

Or maybe I accidentally removed that part while trying things

Nope, it's definitely still there. Something like this:

/* in prep_brlcad \/ */
char title [1024] = {0};
rtip = rt_dirbuild(db_path.c_str(), title, sizeof(title));
m_resources = static_cast<resource*>(bu_calloc(1, sizeof(resource)*100, "appleseed"));
for (size_t i = 0; i < 100; i++) {
    rt_init_resource(&m_resources[i], i, rtip);
    RT_CK_RESOURCE(&m_resources[i]);
}

/* in intersect \/ */
int cpu = bu_parallel_id();
ap->a_resource = &m_resources[cpu];
rt_shootray(ap);

view this post on Zulip Jeff Sieu (Jan 20 2018 at 03:27):

you'l have to figure out a way to determine which thread you are when the plugin is running

For me, just printing out bu_parallel_id() during intersect() always gives me 0

view this post on Zulip Mitesh (Jan 20 2018 at 16:39):

extremely sorry...I have chemistry practicals final exam on monday...so I won't be much active..

view this post on Zulip Naseef (Jan 20 2018 at 19:33):

Good luck with the exams! @Mitesh .

view this post on Zulip Sean (Jan 23 2018 at 00:28):

@Jeff Sieu bu_parallel_id() is only useful if you use bu_parallel() threading. appleseed is going to be doing their own threading, so you need to figure out which thread is running, or set/look up an ID, or hash an ID based on some system lookup, etc.

view this post on Zulip Sean (Jan 23 2018 at 00:29):

that 0 every time is the problem -- they're all using the same resource and clobbering data (hence the crash)

view this post on Zulip Mitesh (Jan 23 2018 at 09:01):

Hi everyone...Got no change in result when included tcl libraries

view this post on Zulip Sean (Jan 23 2018 at 09:02):

you need to include more than the tcl libs

view this post on Zulip Sean (Jan 23 2018 at 09:02):

what are you including?

view this post on Zulip Sean (Jan 23 2018 at 09:02):

and how

view this post on Zulip Mitesh (Jan 23 2018 at 09:05):

includinglib.PNG

view this post on Zulip Mitesh (Jan 23 2018 at 09:06):

including libraries using cmakelists.....

view this post on Zulip Sean (Jan 23 2018 at 09:06):

that doesn't look normal to me... there should just be one target_link_libraries directive

view this post on Zulip Sean (Jan 23 2018 at 09:06):

you list all of the libs

view this post on Zulip Mitesh (Jan 23 2018 at 09:07):

all of the libs- means the libraries that I have included?

view this post on Zulip Sean (Jan 23 2018 at 09:08):

it means all of the libraries that the plugin requires

view this post on Zulip Sean (Jan 23 2018 at 09:12):

try just listing them all after the appleseed libs

view this post on Zulip Sean (Jan 23 2018 at 09:13):

or bunch them together in quotes, separated with semicolon

view this post on Zulip Mitesh (Jan 23 2018 at 09:13):

target_link_libraries (sphereobject ${APPLESEED_LIBRARIES} H:\\BRLCAD7.26.0\\lib\\libbu.lib H:\\BRLCAD7.26.0\\lib\\librt.lib H:\\BRLCAD7.26.0\\lib\\libbn.lib H:\\BRLCAD7.26.0\\lib\\libwdb.lib H:\\BRLCAD7.26.0\\lib\\librt-static.lib H:\\BRLCAD7.26.0\\lib\\tcl.lib H:\\BRLCAD7.26.0\\lib\\brlcad.lib )

is this correct?

view this post on Zulip Sean (Jan 23 2018 at 09:13):

it's a start, maybe

view this post on Zulip Mitesh (Jan 23 2018 at 09:14):

well this gives no difference in the result

view this post on Zulip Sean (Jan 23 2018 at 09:14):

the order sometimes matters -- the less dependent libs should come last

view this post on Zulip Sean (Jan 23 2018 at 09:15):

i.e., brlcad, wdb, rt, bn, bu

view this post on Zulip Sean (Jan 23 2018 at 09:15):

looks like you're missing some too

view this post on Zulip Sean (Jan 23 2018 at 09:15):

openNURBS comes to mind

view this post on Zulip Sean (Jan 23 2018 at 09:16):

you're also mixing static with non-static, which is wrong

view this post on Zulip Sean (Jan 23 2018 at 09:16):

remove librt-static

view this post on Zulip Mitesh (Jan 23 2018 at 09:20):

after all the changes got same result.

view this post on Zulip Sean (Jan 23 2018 at 09:21):

did you try the semicolon?

view this post on Zulip Mitesh (Jan 23 2018 at 09:21):

target_link_libraries (sphereobject
    ${APPLESEED_LIBRARIES} H:\\BRLCAD7.26.0\\lib\\brlcad.lib H:\\BRLCAD7.26.0\\lib\\libwdb.lib H:\\BRLCAD7.26.0\\lib\\librt.lib H:\\BRLCAD7.26.0\\lib\\libbn.lib H:\\BRLCAD7.26.0\\lib\\libbu.lib H:\\BRLCAD7.26.0\\lib\\tcl.lib  H:\\BRLCAD7.26.0\\lib\\openNURBS.lib
)

view this post on Zulip Mitesh (Jan 23 2018 at 09:23):

not added semicolon...
visual studio adds semicolon if there is "space"
nsc.PNG

view this post on Zulip Sean (Jan 23 2018 at 09:23):

ah, good, that's reassuring

view this post on Zulip Sean (Jan 23 2018 at 09:24):

so what exactly are you trying to do?

view this post on Zulip Mitesh (Jan 23 2018 at 09:24):

trying to link brlcad libraries with sphereobject...

view this post on Zulip Sean (Jan 23 2018 at 09:24):

you need to be more specific

view this post on Zulip Sean (Jan 23 2018 at 09:25):

you say sphereobject, am I to assume this is appleseed's demo code? is it modified?

view this post on Zulip Sean (Jan 23 2018 at 09:25):

how is it being compiled?

view this post on Zulip Mitesh (Jan 23 2018 at 09:27):

yes it is the appleseed's demo code. No it is not modified...it is being compiled in x64 release mode.

view this post on Zulip Sean (Jan 23 2018 at 09:28):

then it should work if you leave off all the brl-cad libs?

view this post on Zulip Sean (Jan 23 2018 at 09:28):

otherwise what do you need them for?

view this post on Zulip Mitesh (Jan 23 2018 at 09:29):

well i have simply copied the brlcad rtexample.c functions in it and for those functions I need libraries...

view this post on Zulip Sean (Jan 23 2018 at 09:48):

so ... when you tell me "No it is not modified", I start to doubt other responses :)

view this post on Zulip Sean (Jan 23 2018 at 09:48):

that is very much a modification

view this post on Zulip Sean (Jan 23 2018 at 09:49):

so the next question is whether it worked before your modification

view this post on Zulip Sean (Jan 23 2018 at 09:49):

and can you undo your changes and demonstrate it still works

view this post on Zulip Mitesh (Jan 23 2018 at 10:00):

ya...sure.

view this post on Zulip Sean (Jan 23 2018 at 10:02):

screenshot?

view this post on Zulip Mitesh (Jan 23 2018 at 10:02):

itworks.PNG

view this post on Zulip Sean (Jan 23 2018 at 10:03):

cool, and what's the code look like now?

view this post on Zulip Mitesh (Jan 23 2018 at 10:04):

sorry. didn't get you

view this post on Zulip Sean (Jan 23 2018 at 10:04):

what's the code look like?

view this post on Zulip Sean (Jan 23 2018 at 10:05):

upload your source code

view this post on Zulip Mitesh (Jan 23 2018 at 10:09):

//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2017 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

// appleseed.renderer headers.
#include "renderer/api/object.h"
#include "renderer/api/project.h"
#include "renderer/api/rendering.h"
#include "renderer/api/scene.h"
#include "renderer/api/types.h"

// todo: fix.
#include "renderer/kernel/shading/shadingray.h"

// appleseed.foundation headers.
#include "foundation/math/ray.h"
#include "foundation/math/scalar.h"
#include "foundation/math/vector.h"
#include "foundation/utility/api/specializedapiarrays.h"
#include "foundation/utility/containers/dictionary.h"
#include "foundation/utility/job/iabortswitch.h"
#include "foundation/utility/searchpaths.h"
#include "foundation/utility/string.h"
// appleseed.main headers.
#include "main/dllvisibility.h"
// Standard headers.
#include <algorithm>
#include <cmath>


namespace asf = foundation;
namespace asr = renderer;

namespace
{
    //
    // A sphere object.
    //
    // The sphere is assumed to be centered at the origin.
    //

    const char* Model = "sphere_object";

    class SphereObject
      : public asr::ProceduralObject
    {
      public:
        // Constructor.
        SphereObject(
            const char*                 name,
            const asr::ParamArray&      params)
          : asr::ProceduralObject(name, params)
          , m_lazy_region_kit(&m_region_kit)
        {
        }

        // Delete this instance.
        void release() override
        {
            delete this;
        }

        // Return a string identifying this object model.
        const char* get_model() const override
        {
            return Model;
        }

        // This method is called once before rendering each frame.
        // Returns true on success, false otherwise.
        virtual bool on_frame_begin(
            const asr::Project&         project,
            const asr::BaseGroup*       parent,
            asr::OnFrameBeginRecorder&  recorder,
            asf::IAbortSwitch*          abort_switch) override
        {
            if (!asr::ProceduralObject::on_frame_begin(project, parent, recorder, abort_switch))
                return false;

            m_radius = get_uncached_radius();
            m_rcp_radius = 1.0 / m_radius;

            return true;
        }

        // Compute the local space bounding box of the object over the shutter interval.
        asr::GAABB3 compute_local_bbox() const override
        {
            const auto r = static_cast<asr::GScalar>(get_uncached_radius());
            return asr::GAABB3(asr::GVector3(-r), asr::GVector3(r));
        }

        // Return the region kit of the object.
        asf::Lazy<asr::RegionKit>& get_region_kit() override
        {
            return m_lazy_region_kit;
        }

        // Access materials slots.
        size_t get_material_slot_count() const override
        {
            return 1;
        }
        const char* get_material_slot(const size_t index) const override
        {
            return "default";
        }

        // Compute the intersection between a ray expressed in object space and
        // the surface of this object and return detailed intersection results.
        void intersect(
            const asr::ShadingRay&  ray,
            IntersectionResult&     result) const override
        {
            const double Epsilon = 1.0e-6;

            const double a = asf::dot(ray.m_org, ray.m_dir);
            const double b = asf::square(a) - dot(ray.m_org, ray.m_org) + asf::square(m_radius);

            if (b < 0.0)
            {
                result.m_hit = false;
                return;
            }

            const double c = std::sqrt(b);

            double t = -a - c;
            if (t < std::max(ray.m_tmin, Epsilon) || t >= ray.m_tmax)
            {
                t = -a + c;
                if (t < std::max(ray.m_tmin, Epsilon) || t >= ray.m_tmax)
                {
                    result.m_hit = false;
                    return;
                }
            }

            result.m_hit = true;

            result.m_distance = true;
            const asf::Vector3d n = asf::normalize(ray.point_at(t));
            result.m_geometric_normal = n;
            result.m_shading_normal = n;

            const asf::Vector3f p(ray.point_at(t) * m_rcp_radius);
            result.m_uv[0] = std::acos(p.y) * asf::RcpPi<float>();
            result.m_uv[1] = std::atan2(-p.z, p.x) * asf::RcpTwoPi<float>();

            result.m_material_slot = 0;

        }

        // Compute the intersection between a ray expressed in object space and
        // the surface of this object and simply return whether there was a hit.
        bool intersect(
            const asr::ShadingRay&  ray) const override
        {

            const double Epsilon = 1.0e-6;

            const double a = asf::dot(ray.m_org, ray.m_dir);
            const double b = asf::square(a) - dot(ray.m_org, ray.m_org) + asf::square(m_radius);

            if (b < 0.0)
                return false;

            const double c = std::sqrt(b);

            const double t1 = -a - c;
            if (t1 >= std::max(ray.m_tmin, Epsilon) && t1 < ray.m_tmax)
                return true;

            const double t2 = -a + c;
            if (t2 >= std::max(ray.m_tmin, Epsilon) && t2 < ray.m_tmax)
                return true;

            return false;


        }


      private:
        asr::RegionKit              m_region_kit;
        asf::Lazy<asr::RegionKit>   m_lazy_region_kit;
        double                      m_radius;
        double                      m_rcp_radius;

        double get_uncached_radius() const
        {
            return m_params.get_optional<double>("radius");
        }
    };


    //
    // Factory for the new object model.
    //

    class SphereObjectFactory
      : public asr::IObjectFactory
    {
      public:
        // Delete this instance.
        void release() override
        {
            delete this;
        }

        // Return a string identifying this object model.
        const char* get_model() const override
        {
            return Model;
        }

        // Return metadata for this object model.
        asf::Dictionary get_model_metadata() const override
        {
            return
                asf::Dictionary()
                    .insert("name", Model)
                    .insert("label", "Sphere Object");

        }

        // Return metadata for the inputs of this object model.
        asf::DictionaryArray get_input_metadata() const override
        {
            asf::DictionaryArray metadata;

            metadata.push_back(
                asf::Dictionary()
                    .insert("name", "radius")
                    .insert("label", "Radius")
                    .insert("type", "numeric")
                    .insert("min",
                        asf::Dictionary()
                            .insert("value", "0.0")
                            .insert("type", "hard"))
                    .insert("max",
                        asf::Dictionary()
                            .insert("value", "10.0")
                            .insert("type", "soft"))
                    .insert("use", "optional")
                    .insert("default", "1.0"));

            return metadata;
        }

        // Create a new single empty object.
        asf::auto_release_ptr<asr::Object> create(
            const char*                 name,
            const asr::ParamArray&      params) const override
        {
            return asf::auto_release_ptr<asr::Object>(new SphereObject(name, params));
        }

        // Create objects, potentially from external assets.
        bool create(
            const char*                 name,
            const asr::ParamArray&      params,
            const asf::SearchPaths&     search_paths,
            const bool                  omit_loading_assets,
            asr::ObjectArray&           objects) const override
        {
            objects.push_back(create(name, params).release());
            return true;
        }
    };
}


//
// Plugin entry point.
//

extern "C"
{
    APPLESEED_DLL_EXPORT asr::IObjectFactory* appleseed_create_object_factory()
    {
        return new SphereObjectFactory();
    }
}

view this post on Zulip Sean (Jan 23 2018 at 10:19):

er, where's the modifications you made?

view this post on Zulip Sean (Jan 23 2018 at 10:19):

I'd expect them to be commented out, no??

view this post on Zulip Mitesh (Jan 23 2018 at 10:20):

i erased it...wait i am adding it again..

view this post on Zulip Sean (Jan 23 2018 at 10:24):

so i'm running out of time, but my suggestion is to start super duper simpler

view this post on Zulip Sean (Jan 23 2018 at 10:25):

like just include a bu header, then make one bu function call like printing bu_parallel_id() or printing a bu_vls string via bu_vls_addr().

view this post on Zulip Sean (Jan 23 2018 at 10:25):

then you should only need to add libbu

view this post on Zulip Jeff Sieu (Jan 23 2018 at 10:26):

@Jeff Sieu bu_parallel_id() is only useful if you use bu_parallel() threading. appleseed is going to be doing their own threading, so you need to figure out which thread is running, or set/look up an ID, or hash an ID based on some system lookup, etc.

Oh, right. I'll see if I can figure something out.

view this post on Zulip Sean (Jan 23 2018 at 10:26):

@Mitesh if that doesn't work, you probably have something else missing

view this post on Zulip Sean (Jan 23 2018 at 10:27):

you can try defining BU_DLL_IMPORTS

view this post on Zulip Sean (Jan 23 2018 at 10:28):

Oh, right. I'll see if I can figure something out.

Be a great question for Franz @Jeff Sieu ;)

view this post on Zulip Mitesh (Jan 23 2018 at 10:33):

//
// This source file is part of appleseed.
// Visit http://appleseedhq.net/ for additional information and resources.
//
// This software is released under the MIT license.
//
// Copyright (c) 2017 Francois Beaune, The appleseedhq Organization
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

// appleseed.renderer headers.
#include "renderer/api/object.h"
#include "renderer/api/project.h"
#include "renderer/api/rendering.h"
#include "renderer/api/scene.h"
#include "renderer/api/types.h"

// todo: fix.
#include "renderer/kernel/shading/shadingray.h"

// appleseed.foundation headers.
#include "foundation/math/ray.h"
#include "foundation/math/scalar.h"
#include "foundation/math/vector.h"
#include "foundation/utility/api/specializedapiarrays.h"
#include "foundation/utility/containers/dictionary.h"
#include "foundation/utility/job/iabortswitch.h"
#include "foundation/utility/searchpaths.h"
#include "foundation/utility/string.h"

// appleseed.main headers.
#include "main/dllvisibility.h"
// Standard headers.
#include <algorithm>
#include <cmath>


#include "H:\BRLCAD7.26.0\include\brlcad\common.h"
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "windows.h"
#include "H:\BRLCAD7.26.0\include\brlcad\vmath.h"       /* vector math macros */
#include "H:\BRLCAD7.26.0\include\brlcad\raytrace.h"        /* librt interface definitions */
#include <iostream>
#include <fstream>
#include "renderer/api/object.h"
#include "renderer/api/project.h"
#include "renderer/api/rendering.h"
#include "renderer/api/scene.h"
#include "renderer/api/types.h"

#define BU_DLL_IMPORTS

namespace asf = foundation;
namespace asr = renderer;


int
hit(struct application *ap, struct partition *PartHeadp, struct seg *UNUSED(segs))
{
    /* iterating over partitions, this will keep track of the current
    * partition we're working on.
    */


    struct partition *pp;

    /* will serve as a pointer for the entry and exit hitpoints */
    struct hit *hitp;

    /* will serve as a pointer to the solid primitive we hit */
    struct soltab *stp;

    /* will contain surface curvature information at the entry */
    struct curvature cur = RT_CURVATURE_INIT_ZERO;

    /* will contain our hit point coordinate */
    point_t pt;

    /* will contain normal vector where ray enters geometry */
    vect_t inormal;

    /* will contain normal vector where ray exits geometry */
    vect_t onormal;

    /* iterate over each partition until we get back to the head.
    * each partition corresponds to a specific homogeneous region of
    * material.
    */
    for (pp = PartHeadp->pt_forw; pp != PartHeadp; pp = pp->pt_forw) {

        /* print the name of the region we hit as well as the name of
        * the primitives encountered on entry and exit.
        */
        bu_log("\n--- Hit region %s (in %s, out %s)\n",
            pp->pt_regionp->reg_name,
            pp->pt_inseg->seg_stp->st_name,
            pp->pt_outseg->seg_stp->st_name);

        /* entry hit point, so we type less */
        hitp = pp->pt_inhit;

        /* construct the actual (entry) hit-point from the ray and the
        * distance to the intersection point (i.e., the 't' value).
        */
        VJOIN1(pt, ap->a_ray.r_pt, hitp->hit_dist, ap->a_ray.r_dir);

        /* primitive we encountered on entry */
        stp = pp->pt_inseg->seg_stp;

        /* compute the normal vector at the entry point, flipping the
        * normal if necessary.
        */
        RT_HIT_NORMAL(inormal, hitp, stp, &(ap->a_ray), pp->pt_inflip);

        /* print the entry hit point info */
        rt_pr_hit("  In", hitp);
        /*
        VPRINT("  Ipoint", pt);
        VPRINT("  Inormal", inormal);

        */

        /* This next macro fills in the curvature information which
        * consists on a principle direction vector, and the inverse
        * radii of curvature along that direction and perpendicular
        * to it.  Positive curvature bends toward the outward
        * pointing normal.
        */
        RT_CURVATURE(&cur, hitp, pp->pt_inflip, stp);

        /* print the entry curvature information */
        /*VPRINT("PDir", cur.crv_pdir);*/
        bu_log(" c1=%g\n", cur.crv_c1);
        bu_log(" c2=%g\n", cur.crv_c2);

        /* exit point, so we type less */
        hitp = pp->pt_outhit;

        /* construct the actual (exit) hit-point from the ray and the
        * distance to the intersection point (i.e., the 't' value).
        */
        VJOIN1(pt, ap->a_ray.r_pt, hitp->hit_dist, ap->a_ray.r_dir);

        /* primitive we exited from */
        stp = pp->pt_outseg->seg_stp;

        /* compute the normal vector at the exit point, flipping the
        * normal if necessary.
        */
        RT_HIT_NORMAL(onormal, hitp, stp, &(ap->a_ray), pp->pt_outflip);

        /* print the exit hit point info */
        rt_pr_hit("  Out", hitp);
        /*VPRINT("  Opoint", pt);
        VPRINT("  Onormal", onormal);*/

    }

    /* A more complicated application would probably fill in a new
    * local application structure and describe, for example, a
    * reflected or refracted ray, and then call rt_shootray() for
    * those rays.
    */

    /* Hit routine callbacks generally return 1 on hit or 0 on miss.
    * This value is returned by rt_shootray().
    */
    return 1;
}



int
miss(struct application *UNUSED(ap))
{
    bu_log("missed\n");

    return 0;

}


namespace
{
    //
    // A sphere object.
    //
    // The sphere is assumed to be centered at the origin.
    //

    const char* Model = "sphere_object";

    class SphereObject
      : public asr::ProceduralObject
    {
      public:
        // Constructor.
        SphereObject(
            const char*                 name,
            const asr::ParamArray&      params)
          : asr::ProceduralObject(name, params)
          , m_lazy_region_kit(&m_region_kit)
        {
        }

        // Delete this instance.
        void release() override
        {
            delete this;
        }

        // Return a string identifying this object model.
        const char* get_model() const override
        {
            return Model;
        }

        // This method is called once before rendering each frame.
        // Returns true on success, false otherwise.
        virtual bool on_frame_begin(
            const asr::Project&         project,
            const asr::BaseGroup*       parent,
            asr::OnFrameBeginRecorder&  recorder,
            asf::IAbortSwitch*          abort_switch) override
        {
            if (!asr::ProceduralObject::on_frame_begin(project, parent, recorder, abort_switch))
                return false;

            m_radius = get_uncached_radius();
            m_rcp_radius = 1.0 / m_radius;

            return true;
        }

        // Compute the local space bounding box of the object over the shutter interval.
        asr::GAABB3 compute_local_bbox() const override
        {
            const auto r = static_cast<asr::GScalar>(get_uncached_radius());
            return asr::GAABB3(asr::GVector3(-r), asr::GVector3(r));
        }

        // Return the region kit of the object.
        asf::Lazy<asr::RegionKit>& get_region_kit() override
        {
            return m_lazy_region_kit;
        }

        // Access materials slots.
        size_t get_material_slot_count() const override
        {
            return 1;
        }
        const char* get_material_slot(const size_t index) const override
        {
            return "default";
        }

        // Compute the intersection between a ray expressed in object space and
        // the surface of this object and return detailed intersection results.
        void intersect(
            const asr::ShadingRay&  ray,
            IntersectionResult&     result) const override
        {
            const double Epsilon = 1.0e-6;

            const double a = asf::dot(ray.m_org, ray.m_dir);
            const double b = asf::square(a) - dot(ray.m_org, ray.m_org) + asf::square(m_radius);

            if (b < 0.0)
            {
                result.m_hit = false;
                return;
            }

            const double c = std::sqrt(b);

            double t = -a - c;
            if (t < std::max(ray.m_tmin, Epsilon) || t >= ray.m_tmax)
            {
                t = -a + c;
                if (t < std::max(ray.m_tmin, Epsilon) || t >= ray.m_tmax)
                {
                    result.m_hit = false;
                    return;
                }
            }

            result.m_hit = true;

            result.m_distance = true;
            const asf::Vector3d n = asf::normalize(ray.point_at(t));
            result.m_geometric_normal = n;
            result.m_shading_normal = n;

            const asf::Vector3f p(ray.point_at(t) * m_rcp_radius);
            result.m_uv[0] = std::acos(p.y) * asf::RcpPi<float>();
            result.m_uv[1] = std::atan2(-p.z, p.x) * asf::RcpTwoPi<float>();

            result.m_material_slot = 0;

            struct application  ap;
            int argc = 3;
            static struct rt_i *rtip;


            char title[1024] = { 0 };


            if (argc < 3) {
                bu_exit(1, "Usage: %s model.g objects...\n", "sphereobject");
            }

            rtip = rt_dirbuild("sphere.g", title, sizeof(title));
            if (rtip == RTI_NULL) {
                bu_exit(2, "Building the database directory for [%s] FAILED\n", "sphere.g");
            }

        }

   ```

view this post on Zulip Mitesh (Jan 23 2018 at 10:35):

Actually I was check int main statement of rtexample.c line by line....
when I reached this rtip = rt_dirbuild("sphere.g", title, sizeof(title)); line I found that when I don't include it...it works i.e sphereobject renders and there are no issues

view this post on Zulip Mitesh (Jan 23 2018 at 10:36):

but when I include it ( rtip = rt_dirbuild("sphere.g", title, sizeof(title));) it shows error.

view this post on Zulip Mitesh (Jan 23 2018 at 10:39):

I have also defined BU_DLL_IMPORTS...but still getting same result

view this post on Zulip Mitesh (Jan 23 2018 at 10:44):

should I send .dll file generated?

view this post on Zulip Jeff Sieu (Jan 23 2018 at 11:17):

@Sean
Franz replied with:

1. in the on_frame_begin() method of your procedural object, you need to know how many threads will be used for rendering
2. in the intersect() method of your procedural object, you need to know the index of the current thread

i'm afraid none of these is exposed at the moment

:/

view this post on Zulip Sean (Jan 23 2018 at 16:03):

@Jeff Sieu that's okay, there's still a couple slow ways that should work or you can look into exposing the current thread (better)

view this post on Zulip Sean (Jan 23 2018 at 16:12):

@Jeff Sieu try this poor man's way -- ask franz what he's using for threading, but assuming it's pthreads or boost threads or std::thread, then something like this should work

view this post on Zulip Jeff Sieu (Jan 23 2018 at 16:15):

I think it's pthreads, I dug up a bit in their code and found a few pthread_ts here and there.

view this post on Zulip Jeff Sieu (Jan 23 2018 at 16:16):

I tried calling pthread_self(); to get the current thread id, which actually works.

view this post on Zulip Sean (Jan 23 2018 at 16:17):

static in get_id() { static std::unordered_map<std::thread::id, int> ids; static int next; static std::mutex m; auto thread = std::this_thread::get_id(); auto id = ids[thread]; std::lock(m); id = ++next; ids[thread] = id; std::unlock(m); return id - 1; }

view this post on Zulip Sean (Jan 23 2018 at 16:18):

so in on_frame_begin() or wherever you run dirbuild, you'll need to rt_resource_init() a bunch of resources (say 1024)

view this post on Zulip Sean (Jan 23 2018 at 16:19):

then in intersect() where you are calling rt_shootray(), call get_id() (which needs to be compiled as c++ obviously)

view this post on Zulip Sean (Jan 23 2018 at 16:19):

that's got some c++11 in there, so you might need to add --std=c++11 compile flags

view this post on Zulip Sean (Jan 23 2018 at 16:20):

and that's just off the cuff, so there might be a typo -- should check it ;)

view this post on Zulip Sean (Jan 23 2018 at 16:20):

that's not going to be the fastest, but should do the trick

view this post on Zulip Jeff Sieu (Jan 23 2018 at 16:22):

and that's just off the cuff, so there might be a typo -- should check it ;)

in is not a type haha

view this post on Zulip Jeff Sieu (Jan 23 2018 at 16:23):

I'm gonna try this now.

view this post on Zulip Sean (Jan 23 2018 at 16:23):

ah, yes int

view this post on Zulip Sean (Jan 23 2018 at 16:24):

oh, static int next = 0;

view this post on Zulip Sean (Jan 23 2018 at 16:24):

and probably should ids = {0}; too

view this post on Zulip Jeff Sieu (Jan 23 2018 at 16:29):

hmm, is this supposed to return higher and higher numbers? it sorta increases to something like 40000 in 5 seconds

view this post on Zulip Sean (Jan 23 2018 at 16:55):

that's not right

view this post on Zulip Sean (Jan 23 2018 at 16:56):

oh, add if (id == 0) before the id = ++next

view this post on Zulip Sean (Jan 23 2018 at 16:56):

if (id == 0) { id = ... } std::unlock ...

view this post on Zulip Jeff Sieu (Jan 23 2018 at 17:06):

Okay, that works now but when I do

int cpu = get_id();
ap->a_resource = &m_resources[cpu];
rt_shootray(ap);

it still returns that whole NULL struct seg pointer error:

ERROR: NULL struct seg pointer, file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1758

ERROR: NULL struct seg pointer, file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1758

Saving stack trace to appleseed.studio-18336-bomb.log
BU_ASSERT((void *)(((struct bu_list *)(_zap))->forw) != (void *)NULL), failed, file /home/jeff/Documents/brlcad/src/librt/shoot.c, line 1503

BU_ASSERT failure

BU_ASSERT failure

rt_boolfinal:  sorting defect 5.014334e+02 > 2.162338e-318! x0 y0 lvl0, diff = 501.433
sort defect is between parts 0x7f6410007d70 and (nil)

ERROR: NULL struct partition pointer, file /home/jeff/Documents/brlcad/src/librt/pr.c, line 112

ERROR: NULL struct partition pointer, file /home/jeff/Documents/brlcad/src/librt/pr.c, line 112


ERROR: bad pointer 0x7f644b097300: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

ERROR: bad pointer 0x7f644b097300: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

ERROR: bad pointer 0x7f6448892280: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

ERROR: bad pointer 0x7f6448892280: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

write failed: Bad file descriptor

ERROR: bad pointer 0x7f64437fb280: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

ERROR: bad pointer 0x7f64437fb280: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

ERROR: bad pointer 0x7f644a896300: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

ERROR: bad pointer 0x7f644a896300: s/b struct partition(x87687681), was pt_hd magic(x87687680), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 1490

write failed: Bad file descriptor

ERROR: bad pointer 0x7f646c56f118: s/b struct seg(x98bcdef1), was bu_list(x1016580), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 175


Bad magic number in re_solid_btiv list

Bad magic number in re_solid_btiv list

ERROR: bad pointer 0x7f646c56f118: s/b struct seg(x98bcdef1), was bu_list(x1016580), file /home/jeff/Documents/brlcad/src/librt/bool.c, line 175

[1]    18336 segmentation fault (core dumped)  ../../../bin/Release/appleseed.studio

view this post on Zulip Sean (Jan 24 2018 at 05:48):

@Mitesh so you went from 0 to 10 in that jump ... way too big a step since you're facing problems

view this post on Zulip Sean (Jan 24 2018 at 05:51):

there are a number of issues in the code, so I suggest you comment-out all the brl-cad code and start with something super simple like I mentioned the other day -- a single bu call

view this post on Zulip Sean (Jan 24 2018 at 06:00):

then it'll be easier to sort out the header includes and bu import, make sure that works before jumping to a far more complicated code setup with librt and other issues

view this post on Zulip Sean (Jan 24 2018 at 06:08):

Okay, that works now but when I do ...[snip]...

@Jeff Sieu that's still looking like initialization failure/corruption. what's the rest of your code look like?

view this post on Zulip Sean (Jan 24 2018 at 06:09):

you need to set a bunch of other ap fields, like the a_rt_i to what you prepped, and the resources had to be initialized

view this post on Zulip Jeff Sieu (Jan 25 2018 at 14:54):

@Sean brlcadplugin.cpp

view this post on Zulip Jeff Sieu (Jan 27 2018 at 17:43):

Any clue as to what I'm doing wrong here?

view this post on Zulip Sean (Jan 30 2018 at 02:30):

@Jeff Sieu you have to be SUPER close... I'm not seeing any blatant mistakes in the code

view this post on Zulip Sean (Jan 30 2018 at 02:32):

except you did miss the follow-up corrections I mentioned, like initializing next to 0...

view this post on Zulip Sean (Jan 30 2018 at 02:32):

should initialize the id's to 0 too

view this post on Zulip Sean (Jan 30 2018 at 02:33):

@Mitesh any progress?

view this post on Zulip Mitesh (Jan 30 2018 at 03:20):

@Mitesh any progress?

no....I have commented out the whole rtexample.c
then added bu_log("welcome");
It was built successfully.
but when I opened sphereobject.appleseed got same result

view this post on Zulip Sean (Jan 30 2018 at 03:21):

and if you take out the bu_log it works?

view this post on Zulip Sean (Jan 30 2018 at 03:21):

er, comment-out

view this post on Zulip Mitesh (Jan 30 2018 at 03:22):

yes...it works

view this post on Zulip Sean (Jan 30 2018 at 03:22):

okay, great, that's actually progress then :)

view this post on Zulip Sean (Jan 30 2018 at 03:22):

so next, what's your build instructions look like?

view this post on Zulip Sean (Jan 30 2018 at 03:22):

can you post your cmakelists file?

view this post on Zulip Mitesh (Jan 30 2018 at 03:23):

CMakeLists.txt

view this post on Zulip Mitesh (Jan 30 2018 at 03:23):

1>------ Build started: Project: sphereobject, Configuration: Release x64 ------
1> sphereobject.cpp
1> Unknown compiler version - please run the configure tests and report the results
1>h:\brlcad7.26.0\include\brlcad\brep/bbnode.h(277): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>h:\brlcad7.26.0\include\brlcad\brep/bbnode.h(278): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>h:\brlcad7.26.0\include\brlcad\brep/bbnode.h(279): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>h:\brlcad7.26.0\include\brlcad\brep/bbnode.h(280): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>h:\brlcad7.26.0\include\brlcad\brep/bbnode.h(281): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>h:\brlcad7.26.0\include\brlcad\brep/bbnode.h(282): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1> Creating library H:/task5/appleseed/samples/cpp/sphereobject/build/Release/sphereobject.lib and object H:/task5/appleseed/samples/cpp/sphereobject/build/Release/sphereobject.exp
1> sphereobject.vcxproj -> H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

view this post on Zulip Sean (Jan 30 2018 at 03:30):

okay, that's looking mostly okay

view this post on Zulip Mitesh (Jan 30 2018 at 03:30):

the bu_log function shows log enetere in it, right?

view this post on Zulip Sean (Jan 30 2018 at 03:30):

try adding some import definitions

view this post on Zulip Sean (Jan 30 2018 at 03:31):

enetere?

view this post on Zulip Mitesh (Jan 30 2018 at 03:31):

entered*

view this post on Zulip Sean (Jan 30 2018 at 03:32):

adding the bu_log() call will cause the linker to look for that symbol, which is in libbu.lib

view this post on Zulip Mitesh (Jan 30 2018 at 03:32):

I have already added #define BU_DLL_IMPORTS...any other?

view this post on Zulip Sean (Jan 30 2018 at 03:32):

so in order for it to find it, it needs 1) to be told where the lib is and 2) to import that function

view this post on Zulip Sean (Jan 30 2018 at 03:32):

where? that's not in the cmakelists.txt you posted

view this post on Zulip Mitesh (Jan 30 2018 at 03:33):

in my cpp file

view this post on Zulip Sean (Jan 30 2018 at 03:33):

that's not where it belongs

view this post on Zulip Sean (Jan 30 2018 at 03:34):

you'd have to guarantee it's included before anything that potentially includes any bu header

view this post on Zulip Sean (Jan 30 2018 at 03:34):

add_definitions(-DBU_DLL_IMPORTS=1)

view this post on Zulip Sean (Jan 30 2018 at 03:35):

you should also remove all libs except appleseed_libraries and libbu.lib from the target_link_libraries line

view this post on Zulip Mitesh (Jan 30 2018 at 03:40):

CMakeLists.txt

view this post on Zulip Mitesh (Jan 30 2018 at 03:40):

no change in result

view this post on Zulip Sean (Jan 30 2018 at 03:42):

and remind me, what is the result exactly?

view this post on Zulip Mitesh (Jan 30 2018 at 03:42):

while defining object "sphere": invalid model "sphere_object".

view this post on Zulip Mitesh (Jan 30 2018 at 03:43):

failed to load project file H:\task5\appleseed\samples\cpp\sphereobject\sphereobject.appleseed (1 error, 0 warning).

view this post on Zulip Mitesh (Jan 30 2018 at 03:43):

sphobj.PNG

view this post on Zulip Sean (Jan 30 2018 at 03:44):

er, the lines there in the screenshot look rather important

view this post on Zulip Mitesh (Jan 30 2018 at 03:45):

ya....it also says....

could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.

view this post on Zulip Sean (Jan 30 2018 at 03:45):

yep, that's kind of a kill shot right there

view this post on Zulip Sean (Jan 30 2018 at 03:46):

what's that "shared library ..." line say?

view this post on Zulip Mitesh (Jan 30 2018 at 03:46):

ya I placed the libbu.dll there so that the plugin can find it.

view this post on Zulip Sean (Jan 30 2018 at 03:47):

when, just now or some time earlier?

view this post on Zulip Mitesh (Jan 30 2018 at 03:47):

today in the morning.

view this post on Zulip Sean (Jan 30 2018 at 03:48):

so is that just now or some time earlier? I have no idea what time it is for you :)

view this post on Zulip Mitesh (Jan 30 2018 at 03:48):

now

view this post on Zulip Sean (Jan 30 2018 at 03:49):

and the other line?

view this post on Zulip Mitesh (Jan 30 2018 at 03:50):

2018-01-30T03:43:13.163952Z <001> 38 MB info | appleseed.dll version 1.8.0-beta (SSE 4.2), Release configuration
2018-01-30T03:43:13.163952Z <001> 38 MB info | compiled on Nov 26 2017 at 17:11:55 using Microsoft Visual C++ version 1900
2018-01-30T03:43:13.164955Z <001> 38 MB info | system information:
2018-01-30T03:43:13.164955Z <001> 38 MB info | architecture x86 64-bit
2018-01-30T03:43:13.164955Z <001> 38 MB info | logical cores 4
2018-01-30T03:43:13.164955Z <001> 38 MB info | L1 data cache size 32.0 KB, line size 64 bytes
2018-01-30T03:43:13.164955Z <001> 38 MB info | L2 cache size 256.0 KB, line size 64 bytes
2018-01-30T03:43:13.164955Z <001> 38 MB info | L3 cache size 3.0 MB, line size 64 bytes
2018-01-30T03:43:13.164955Z <001> 38 MB info | instruction sets sse sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2 fma3
2018-01-30T03:43:13.164955Z <001> 38 MB info | physical memory size 7.8 GB
2018-01-30T03:43:13.164955Z <001> 38 MB info | virtual memory size 9.1 GB
2018-01-30T03:43:13.170823Z <001> 39 MB info | successfully loaded settings from H:\appleseed\settings\appleseed.studio.xml.
2018-01-30T03:43:13.205736Z <002> 40 MB info | loading project file H:\task5\appleseed\samples\cpp\sphereobject\sphereobject.appleseed...
2018-01-30T03:43:13.206740Z <002> 41 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of aov plugins...
2018-01-30T03:43:13.206740Z <002> 41 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed aov plugin because it does not export a appleseed_create_aov_factory() function.
2018-01-30T03:43:13.206740Z <002> 41 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.206740Z <002> 41 MB debug | .
2018-01-30T03:43:13.206740Z <002> 41 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.206740Z <002> 41 MB debug | .
2018-01-30T03:43:13.206740Z <002> 41 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of assembly plugins...
2018-01-30T03:43:13.206740Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed assembly plugin because it does not export a appleseed_create_assembly_factory() function.
2018-01-30T03:43:13.206740Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.206740Z <002> 45 MB debug | .
2018-01-30T03:43:13.226526Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.226526Z <002> 45 MB debug | .
2018-01-30T03:43:13.226526Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of bsdf plugins...
2018-01-30T03:43:13.228600Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed bsdf plugin because it does not export a appleseed_create_bsdf_factory() function.
2018-01-30T03:43:13.230739Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.230739Z <002> 45 MB debug | .
2018-01-30T03:43:13.232384Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.232384Z <002> 45 MB debug | .
2018-01-30T03:43:13.232384Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of bssrdf plugins...
2018-01-30T03:43:13.234699Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed bssrdf plugin because it does not export a appleseed_create_bssrdf_factory() function.
2018-01-30T03:43:13.235723Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.235723Z <002> 45 MB debug | .
2018-01-30T03:43:13.236867Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.236867Z <002> 45 MB debug | .
2018-01-30T03:43:13.237934Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of camera plugins...
2018-01-30T03:43:13.243131Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed camera plugin because it does not export a appleseed_create_camera_factory() function.
2018-01-30T03:43:13.244134Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.244134Z <002> 45 MB debug | .
2018-01-30T03:43:13.245137Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.245137Z <002> 45 MB debug | .
2018-01-30T03:43:13.246140Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of edf plugins...
2018-01-30T03:43:13.247296Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed edf plugin because it does not export a appleseed_create_edf_factory() function.
2018-01-30T03:43:13.249374Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.249374Z <002> 45 MB debug | .
2018-01-30T03:43:13.251061Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.251061Z <002> 45 MB debug | .
2018-01-30T03:43:13.251385Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of environment edf plugins...
2018-01-30T03:43:13.253891Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed environment edf plugin because it does not export a appleseed_create_environment_edf_factory() function.
2018-01-30T03:43:13.255896Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.255896Z <002> 45 MB debug | .
2018-01-30T03:43:13.257400Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T03:43:13.257400Z <002> 45 MB debug | .
2018-01-30T03:43:13.258408Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of environment shader plugins...
2018-01-30T03:43:13.262413Z <002> 46 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed environment shader plugin because it does not export a appleseed_create_environment_shader_factory() function.
2018-01-30T03:43:13.263417Z <002> 46 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\libbu.dll: Cannot load shared library H:\task5\appleseed\samples

view this post on Zulip Sean (Jan 30 2018 at 03:54):

hm, okay so this is entirely a problem with the linking

view this post on Zulip Sean (Jan 30 2018 at 03:56):

try changing "SHARED" to "MODULE" in your cmakelists.txt file, and remove that libbu.dll from sphereobject\build\Release

view this post on Zulip Sean (Jan 30 2018 at 03:57):

if it can't find the dll where you told cmake it was at, you have other problems -- you shouldn't need to copy the libs into there

view this post on Zulip Sean (Jan 30 2018 at 03:59):

another problem that may be causing this is your use of full paths instead of specifying libs properly via search paths -- that can cause different dynamic linker behavior when it tries to find dependency libraries

view this post on Zulip Sean (Jan 30 2018 at 03:59):

but start with MODULE...

view this post on Zulip Mitesh (Jan 30 2018 at 03:59):

like this ?
add_library (sphereobject MODULE sphereobject.cpp)

view this post on Zulip Sean (Jan 30 2018 at 03:59):

yes

view this post on Zulip Sean (Jan 30 2018 at 04:00):

remove the libbu.dll from that Release dir and post the new output

view this post on Zulip Mitesh (Jan 30 2018 at 04:01):

new_output.PNG

view this post on Zulip Sean (Jan 30 2018 at 04:02):

can you just paste the text like before -- it's hard to tell what's being left out

view this post on Zulip Sean (Jan 30 2018 at 04:03):

always important to read all your output when debugging, have a good idea what each message is saying ;)

view this post on Zulip Mitesh (Jan 30 2018 at 04:05):

2018-01-30T04:00:22.792441Z <001> 38 MB info | appleseed.dll version 1.8.0-beta (SSE 4.2), Release configuration
2018-01-30T04:00:22.792441Z <001> 38 MB info | compiled on Nov 26 2017 at 17:11:55 using Microsoft Visual C++ version 1900
2018-01-30T04:00:22.793095Z <001> 38 MB info | system information:
2018-01-30T04:00:22.793095Z <001> 38 MB info | architecture x86 64-bit
2018-01-30T04:00:22.793095Z <001> 38 MB info | logical cores 4
2018-01-30T04:00:22.793095Z <001> 38 MB info | L1 data cache size 32.0 KB, line size 64 bytes
2018-01-30T04:00:22.793095Z <001> 38 MB info | L2 cache size 256.0 KB, line size 64 bytes
2018-01-30T04:00:22.793095Z <001> 38 MB info | L3 cache size 3.0 MB, line size 64 bytes
2018-01-30T04:00:22.793095Z <001> 38 MB info | instruction sets sse sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2 fma3
2018-01-30T04:00:22.793095Z <001> 38 MB info | physical memory size 7.8 GB
2018-01-30T04:00:22.793095Z <001> 38 MB info | virtual memory size 9.1 GB
2018-01-30T04:00:22.808324Z <001> 39 MB info | successfully loaded settings from H:\appleseed\settings\appleseed.studio.xml.
2018-01-30T04:00:22.833572Z <002> 40 MB info | loading project file H:\task5\appleseed\samples\cpp\sphereobject\sphereobject.appleseed...
2018-01-30T04:00:22.834574Z <002> 41 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of aov plugins...
2018-01-30T04:00:22.834574Z <002> 41 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed aov plugin because it does not export a appleseed_create_aov_factory() function.
2018-01-30T04:00:22.834574Z <002> 41 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.834574Z <002> 41 MB debug | .
2018-01-30T04:00:22.834574Z <002> 41 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of assembly plugins...
2018-01-30T04:00:22.834574Z <002> 41 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed assembly plugin because it does not export a appleseed_create_assembly_factory() function.
2018-01-30T04:00:22.850209Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.850209Z <002> 45 MB debug | .
2018-01-30T04:00:22.850209Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of bsdf plugins...
2018-01-30T04:00:22.853440Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed bsdf plugin because it does not export a appleseed_create_bsdf_factory() function.
2018-01-30T04:00:22.856381Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.856381Z <002> 45 MB debug | .
2018-01-30T04:00:22.857702Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of bssrdf plugins...
2018-01-30T04:00:22.860575Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed bssrdf plugin because it does not export a appleseed_create_bssrdf_factory() function.
2018-01-30T04:00:22.862634Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.862634Z <002> 45 MB debug | .
2018-01-30T04:00:22.862634Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of camera plugins...
2018-01-30T04:00:22.864662Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed camera plugin because it does not export a appleseed_create_camera_factory() function.
2018-01-30T04:00:22.866668Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.866668Z <002> 45 MB debug | .
2018-01-30T04:00:22.866668Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of edf plugins...
2018-01-30T04:00:22.868840Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed edf plugin because it does not export a appleseed_create_edf_factory() function.
2018-01-30T04:00:22.871277Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.871277Z <002> 45 MB debug | .
2018-01-30T04:00:22.871353Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of environment edf plugins...
2018-01-30T04:00:22.873604Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed environment edf plugin because it does not export a appleseed_create_environment_edf_factory() function.
2018-01-30T04:00:22.879124Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.879124Z <002> 45 MB debug | .
2018-01-30T04:00:22.879624Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of environment shader plugins...
2018-01-30T04:00:22.882129Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed environment shader plugin because it does not export a appleseed_create_environment_shader_factory() function.
2018-01-30T04:00:22.883634Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.883634Z <002> 45 MB debug | .
2018-01-30T04:00:22.883634Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of light plugins...
2018-01-30T04:00:22.886140Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed light plugin because it does not export a appleseed_create_light_factory() function.
2018-01-30T04:00:22.888147Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.888147Z <002> 45 MB debug | .
2018-01-30T04:00:22.888194Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of material plugins...
2018-01-30T04:00:22.893867Z <002> 45 MB debug | shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll is not an appleseed material plugin because it does not export a appleseed_create_material_factory() function.
2018-01-30T04:00:22.895887Z <002> 45 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.895887Z <002> 45 MB debug | .
2018-01-30T04:00:22.895887Z <002> 45 MB debug | scanning H:\task5\appleseed\samples\cpp\sphereobject\build\Release in search of object plugins...
2018-01-30T04:00:22.898915Z <002> 46 MB info | registering object plugin H:\task5\appleseed\samples\cpp\sphereobject\build\Release\infiniteplaneobject.dll...
2018-01-30T04:00:22.899917Z <002> 46 MB debug | could not open shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll: Cannot load shared library H:\task5\appleseed\samples\cpp\sphereobject\build\Release\sphereobject.dll. Error = The specified module could not be found.
2018-01-30T04:00:22.899917Z <002> 46 MB debug | .
2018-01-30T04:00:22.899917Z <002> 46 MB debug | scanning H:\task5\

view this post on Zulip Sean (Jan 30 2018 at 04:05):

next try this: find_library(BRLCAD_BU_LIBRARY bu PATHS H:/BRLCAD7.26.0/lib NO_DEFAULT_PATH)

view this post on Zulip Sean (Jan 30 2018 at 04:06):

and use ${BRLCAD_BU_LIBRARY} instead of that H:\\BRLCAD... path in target_link_libraries

view this post on Zulip Sean (Jan 30 2018 at 04:07):

hm, that output doesn't match your screenshot .. is it truncated?

view this post on Zulip Mitesh (Jan 30 2018 at 04:09):

wait I will add the logs in .txt file and send

view this post on Zulip Mitesh (Jan 30 2018 at 04:10):

apple_logs.txt

view this post on Zulip Sean (Jan 30 2018 at 04:12):

okay, so just truncated ... the printing at the end is really curious given the general module load failure message

view this post on Zulip Sean (Jan 30 2018 at 04:13):

lets see if getting rid of the full-path changes anything, and (assuming it does nothing) confirm what the log output is saying when you only comment out the bu_log line

view this post on Zulip Mitesh (Jan 30 2018 at 04:17):

Please set them or make sure they are set and tested correctly in the CMake files:
2> BRLCAD_BU_LIBRARY

view this post on Zulip Mitesh (Jan 30 2018 at 04:17):

2> -- Configuring incomplete, errors occurred!
2>CUSTOMBUILD : CMake error : The following variables are used in this project, but they are set to NOTFOUND.
2> Please set them or make sure they are set and tested correctly in the CMake files:
2> BRLCAD_BU_LIBRARY
2> linked by target "sphereobject" in directory H:/task5/appleseed/samples/cpp/sphereobject

view this post on Zulip Sean (Jan 30 2018 at 04:18):

well that's telling -- something's wrong with the path then

view this post on Zulip Sean (Jan 30 2018 at 04:18):

can try windows-style backslashes, but you may want to confirm the location

view this post on Zulip Mitesh (Jan 30 2018 at 04:23):

find_library(BRLCAD_BU_LIBRARY bu PATHS H:\\BRLCAD7.26.0\\lib NO_DEFAULT_PATH)

confirmed path with right backslashes....

view this post on Zulip Sean (Jan 30 2018 at 04:24):

so that worked? interesting (windows doesn't care any more, cmake must be dorking with them somehow)

view this post on Zulip Mitesh (Jan 30 2018 at 04:24):

1>CUSTOMBUILD : CMake error : The following variables are used in this project, but they are set to NOTFOUND.
1> -- Configuring incomplete, errors occurred!
1> See also "H:/task5/appleseed/samples/cpp/sphereobject/build/CMakeFiles/CMakeOutput.log".
1> Please set them or make sure they are set and tested correctly in the CMake files:
1> BRLCAD_BU_LIBRARY
1> linked by target "sphereobject" in directory H:/task5/appleseed/samples/cpp/sphereobject
1>
1> CMake Configure step failed. Build files cannot be regenerated correctly. Attempting to stop IDE build.
2>------ Build started: Project: sphereobject, Configuration: Release x64 ------
2> Building Custom Rule H:/task5/appleseed/samples/cpp/sphereobject/CMakeLists.txt
2> CMake is re-running because H:/task5/appleseed/samples/cpp/sphereobject/build/CMakeFiles/generate.stamp is out-of-date.
2> the file 'H:/task5/appleseed/samples/cpp/sphereobject/CMakeLists.txt'
2> is newer than 'H:/task5/appleseed/samples/cpp/sphereobject/build/CMakeFiles/generate.stamp.depend'
2> result='-1'
2> -- Selecting Windows SDK version 10.0.14393.0 to target Windows 10.0.16299.
2> -- Boost version: 1.55.0
2>CUSTOMBUILD : CMake error : The following variables are used in this project, but they are set to NOTFOUND.
2> -- Configuring incomplete, errors occurred!
2> See also "H:/task5/appleseed/samples/cpp/sphereobject/build/CMakeFiles/CMakeOutput.log".
2> Please set them or make sure they are set and tested correctly in the CMake files:
2> BRLCAD_BU_LIBRARY
2> linked by target "sphereobject" in directory H:/task5/appleseed/samples/cpp/sphereobject
2>
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

view this post on Zulip Sean (Jan 30 2018 at 04:25):

er, so then what did you actually "confirm"? because that output is saying the same thing

view this post on Zulip Mitesh (Jan 30 2018 at 04:26):

the path of lib is:

H:\BRLCAD7.26.0\lib

view this post on Zulip Mitesh (Jan 30 2018 at 04:26):

so for "\" we need to use "\\"....which I used.

view this post on Zulip Sean (Jan 30 2018 at 04:26):

ah, I mean confirm the cmake FIND_LIBRARY test works ... or doesn't work

view this post on Zulip Mitesh (Jan 30 2018 at 04:27):

okk...its not working.

view this post on Zulip Sean (Jan 30 2018 at 04:27):

H:\\BRLCAD7.26.0\\lib "should" be the same as H:/BRLCAD7.26.0/lib

view this post on Zulip Sean (Jan 30 2018 at 04:27):

so next is to see why it didn't seem to find libbu

view this post on Zulip Sean (Jan 30 2018 at 04:28):

you'll need to read the CMakeFiles/CMakeError.log file and/or the CMakeOutput.log file to see what they say about libbu

view this post on Zulip Mitesh (Jan 30 2018 at 04:35):

All is going bouncer.....

view this post on Zulip Sean (Jan 30 2018 at 04:35):

what?

view this post on Zulip Mitesh (Jan 30 2018 at 04:36):

I mean all is going above the head...(not understanding much in CMakeOutput.log)

view this post on Zulip Sean (Jan 30 2018 at 04:37):

there's a test somewhere in there for libbu that fails, you have to find it

view this post on Zulip Sean (Jan 30 2018 at 04:37):

start with the error file

view this post on Zulip Mitesh (Jan 30 2018 at 04:40):

well there is no error file...only camkeoutput.log

view this post on Zulip Sean (Jan 30 2018 at 04:41):

er, you're possibly looking in the wrong directory then .. there should be an error log in path/to/builddir/CMakeFiles/.

view this post on Zulip Sean (Jan 30 2018 at 04:42):

post the output log, maybe it's somehow combined in 2017

view this post on Zulip Sean (Jan 30 2018 at 04:42):

but cmake docs are telling me it should be there

view this post on Zulip Mitesh (Jan 30 2018 at 04:43):

CMakeOutput.log

view this post on Zulip Mitesh (Jan 30 2018 at 04:45):

cmake_folder.PNG

view this post on Zulip Mitesh (Jan 30 2018 at 04:45):

also cmake output shows logs of 15-01-2018

view this post on Zulip Sean (Jan 30 2018 at 04:46):

yeah, that doesn't look right

view this post on Zulip Sean (Jan 30 2018 at 04:47):

did you re-run cmake?

view this post on Zulip Mitesh (Jan 30 2018 at 04:47):

no

view this post on Zulip Sean (Jan 30 2018 at 04:47):

hah

view this post on Zulip Sean (Jan 30 2018 at 04:47):

okay, any time you edit CMakeLists.txt .. you MUST re-run cmake, configure, generate

view this post on Zulip Sean (Jan 30 2018 at 04:47):

re-open the new studio file(s) it produces

view this post on Zulip Mitesh (Jan 30 2018 at 04:48):

okk...

view this post on Zulip Sean (Jan 30 2018 at 04:48):

there's no telling which of the changes we've made have worked or not if you've not been doing that :)

view this post on Zulip Mitesh (Jan 30 2018 at 04:50):

Ok my today's quota is over(i have exams)....will update you tommorrow...after i rerun the cmake and whole.....thank you so much....good night

view this post on Zulip Sean (Jan 30 2018 at 04:50):

sure! hopefully it'll all magically work then ;)

view this post on Zulip Sean (Jan 30 2018 at 04:50):

explains a lot!

view this post on Zulip Sean (Jan 30 2018 at 04:51):

might need to switch MODULE back to SHARED, but I'd try it as a MODULE first

view this post on Zulip Mitesh (Jan 30 2018 at 04:52):

yup...I will try all with module first

view this post on Zulip Mitesh (Jan 30 2018 at 04:53):

Its not so simple as I thought earlier..

view this post on Zulip Sean (Jan 30 2018 at 04:53):

sort of ... running cmake is kind of simple, but I can see how not knowing that you need to run it whenever you change a build file might be a new concept

view this post on Zulip Mitesh (Jan 30 2018 at 04:54):

Ya..

view this post on Zulip Mitesh (Jan 30 2018 at 04:55):

ok then will talk tom..bye

view this post on Zulip Sean (Jan 30 2018 at 04:55):

cya! good luck with your exams

view this post on Zulip Jeff Sieu (Jan 30 2018 at 16:22):

except you did miss the follow-up corrections I mentioned, like initializing next to 0...

I tried to initialize ids to 0, but seems like I can't assign a scalar to an unordered_map. And something bazaar happens when I attempt to run this anyway, with next initialized to 0: I get logged out of Ubuntu.

view this post on Zulip Daniel Rossberg (Jan 30 2018 at 19:02):

@Mitesh
If a DLL cannot be loaded it doesn't necessarily mean that this DLL isn't there, it could be because it can't find other DLLs it depends on. You can check this with http://www.dependencywalker.com. Especially the BRL-CAD core needs a lot DLLs, see the target_link_libraries statements here: https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/trunk/misc/win32-msvc/Dll/CMakeLists.txt

I personally would still recommend to go with the brlcad.dll. You could use this https://github.com/drossberg/BrlCadQtGUI/tree/master/BRL-CAD as it is in your project. It has a CMakeLists.txt.

BTW, CMake usually doesn't need to be called explicitly if the project files are generated once. Make or Visual Studio call cmake if they detect a change in the CMakeLists.txt files.

view this post on Zulip Mitesh (Jan 31 2018 at 03:10):

cya! good luck with your exams

thank you

view this post on Zulip Mitesh (Jan 31 2018 at 03:12):

BTW, CMake usually doesn't need to be called explicitly if the project files are generated once. Make or Visual Studio call cmake if they detect a change in the CMakeLists.txt files.

yeah...visual studio detect the changes....

view this post on Zulip Mitesh (Jan 31 2018 at 03:15):

@Mitesh
I personally would still recommend to go with the brlcad.dll. You could use this https://github.com/drossberg/BrlCadQtGUI/tree/master/BRL-CAD as it is in your project. It has a CMakeLists.txt.

Should I build this first?

view this post on Zulip Daniel Rossberg (Jan 31 2018 at 13:14):

Should I build this first?

??? It's part of the sources. Copy the BRL-CAD directory in your AppleSeed plugin source directory, include it with add_subdirectory(BRL-CAD) in your CMakeLists.txt and refer to it with "brlcad" and "BRLCAD_INCLUDE_DIR" like any other sublibrary (see https://github.com/drossberg/BrlCadQtGUI/blob/master/src/CMakeLists.txt for example).

view this post on Zulip Sean (Feb 01 2018 at 03:29):

I tried to initialize ids to 0, but seems like I can't assign a scalar to an unordered_map. And something bazaar happens when I attempt to run this anyway, with next initialized to 0: I get logged out of Ubuntu.

@Jeff Sieu you can, you just need to be using c++11, but... the important one is initializing next to 0... try running in valgrind or in gdb if it's logging you out

view this post on Zulip Sean (Feb 01 2018 at 03:37):

do you know how to do that?

view this post on Zulip Sean (Feb 01 2018 at 03:38):

BTW, CMake usually doesn't need to be called explicitly if the project files are generated once. Make or Visual Studio call cmake if they detect a change in the CMakeLists.txt files.

Interesting... I've never been able to fully reliably trust that to work right on windows

view this post on Zulip Mitesh (Feb 03 2018 at 13:08):

Hey...sorry guys... I am little busy with my exams...will update my work on 14th/15th feb

view this post on Zulip Jeff Sieu (Feb 03 2018 at 13:45):

I tried to initialize ids to 0, but seems like I can't assign a scalar to an unordered_map. And something bazaar happens when I attempt to run this anyway, with next initialized to 0: I get logged out of Ubuntu.

@Jeff Sieu you can, you just need to be using c++11, but... the important one is initializing next to 0... try running in valgrind or in gdb if it's logging you out

ok, ill have a go at it

view this post on Zulip Parth Pandya (Feb 05 2018 at 12:28):

can anyone give my answers?

view this post on Zulip Sean (Feb 05 2018 at 17:06):

@Jeff Sieu if you need help with debugging, how to use a debugger, just ask... the basics with gdb is to just run a program like you normally would, but then prepend "gdb --args" to the command line, then "run" at the gdb prompt

view this post on Zulip Denis Pavlov (May 22 2018 at 17:48):

@Sean , hello. I have been trying to deal with Appleseed dependencies for a few days already and now I am kind of stuck, so I wanted to ask for advice.
First of all, what I have done at this point: I have added "apprt" command to "mged_cmdtab" and created a callback function for it in .c file.
1) Then, I tried to use Appleseed as it is without tclscripts and all this stuff. I have added all the necessary libs to cmake file and a few appleseed includes to the .c file. When I try to build it I get "cstddef: No such file or directory" error. Probably it happens because of name mangling, since mged is compiled with c99 and Appleseed with c++11. Well, that's not surprising.
2) Then I created a .cpp file, compiled in with c++ compiler(it builds okay, without any errors) and tried to call it using extern "C" mechanism from .c file, but I still got some linking errors.
Am I doing something wrong? What's a proper way to do this?
P.S. I am working on Ubuntu 16.04

view this post on Zulip Sean (May 27 2018 at 18:30):

@Denis Pavlov 1) sounds like you need to rename your source file to .cpp so it compiles as c++... cstddef is not a valid header for a .c file.

view this post on Zulip Sean (May 27 2018 at 18:31):

which it sounds like you figured out in 2) but you got things reversed -- you extern "C" in the .cpp file, and then just declare and call the function in a .c files

view this post on Zulip Sean (May 27 2018 at 18:31):

where is your latest code at currently?

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 19:47):

@starseeker regarding the CMake examples you sent me earlier, could I use most of this: https://sourceforge.net/p/brlcad/code/HEAD/tree/rt%5E3/trunk/cmake/FindBRLCAD.cmake inside of my Appleseed configuration file? So when configuring, it looks for BRLCAD, and then I should be able to include the RT library?

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 19:47):

It looks like it looks for BRLCAD through my PATH environment variable (although I'm not quite sure how) in order to find BRLCAD, which should means that I should be able to use it externally, right?

view this post on Zulip starseeker (Dec 14 2019 at 20:03):

@Jeffrey Liu It should work, yes - it's a bit heavy for what you need, but if that's easier there's no reason not to use it

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:05):

Alright, thanks so much for the help! I will try doing it now and see how it works.

view this post on Zulip starseeker (Dec 14 2019 at 20:05):

The simplest thing would be to explicitly supply the .so file paths to target_link_libraries, although that's poor practice for any general use code

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:05):

Would that be the same for dll on Windows?

view this post on Zulip starseeker (Dec 14 2019 at 20:05):

wait - by use, do you mean cut/paste into your code? You probably don't want to do that

view this post on Zulip starseeker (Dec 14 2019 at 20:06):

Ah, Windows. right...

view this post on Zulip starseeker (Dec 14 2019 at 20:06):

might want to check with @Daniel Rossberg on that one

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:07):

Actually, I'm not sure how I wanted to use it. All I really wanted to do was to properly link the librt headers and such so that I could call the proper functions from the appleseed code.

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:07):

It definitely seems like there are some components that wouldn't be necessary for my purposes

view this post on Zulip starseeker (Dec 14 2019 at 20:08):

if you want to use the FindBRLCAD.cmake file, take a look at what rt^3 does in its main CMakeLists.txt file - you should be able to call it the same way

view this post on Zulip starseeker (Dec 14 2019 at 20:09):

you won't use everything it provides, but it should define what you need

view this post on Zulip starseeker (Dec 14 2019 at 20:09):

@Jeffrey Liu I think Daniel posted a question for you over in the Appleseed channel...

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:11):

Sorry, where? I believe I responded to everything that has been directed towards me.

view this post on Zulip starseeker (Dec 14 2019 at 20:11):

https://brlcad.zulipchat.com/#narrow/stream/104238-Google-Code-in/topic/Appleseed

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:14):

Oh, yes, he asked me what exactly I was trying to do with the BRLCAD libraries and I think I responded accordingly. He pointed me towards the dll_devel.zip but after compiling a test it seems like it might be easier to directly link what I need.

view this post on Zulip starseeker (Dec 14 2019 at 20:16):

Ah , I see it now

view this post on Zulip starseeker (Dec 14 2019 at 20:18):

I'll confess I usually do this sort of thing inside BRL-CAD proper, where we have extensive wiring in place for building across multiple platforms... I'd probably just make an "art" executable in src/rt using the existing rt CMake as a template, then add in any needed Appleseed logic. However, that's easier for me since I've been working with that build system for years - it's a lot to take in for a brand new user.

That said, if you want to try it you certainly can.

view this post on Zulip starseeker (Dec 14 2019 at 20:19):

To link BRL-CAD and Appleseed you'd probably want a FindAppleseed.cmake file (we have many similar files in misc/CMake)

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:21):

Creating some sort of "art" executable in src/rt does seem like the end goal in mind for this task set; my apologies for forgetting to mention that I'm working on a specific task, which requires me to call rt_shootray() from an appleseed program.

view this post on Zulip starseeker (Dec 14 2019 at 20:22):

Ah. OK, then I'm leading you down the wrong rabbit hole (at least, for now)

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:22):

I believe that the purpose of this task is to first integrate BRLCAD into appleseed, whereas later tasks are meant to integrate appleseed into BRLCAD

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:23):

Ah. OK, then I'm leading you down the wrong rabbit hole (at least, for now)

It's alright, your advice is very insightful! I'll be sure to keep it in mind for the later tasks.

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:27):

That said, for this specific task, would using part of the example FindBRLCAD.cmake file be enough to configure the appleseed program to call functions from librt? I'm not really sure which parts are necessary and which parts aren't.

view this post on Zulip starseeker (Dec 14 2019 at 20:28):

FindBRLCAD.cmake, if it finds BRL-CAD, will define a series of CMake variables that can then be used in the include_directories and target_link_libraries lines.

view this post on Zulip starseeker (Dec 14 2019 at 20:30):

I'd go ahead and experiment a bit - just bear in mine if you start cutting up the FindBRLCAD.cmake file that it's using loops, lists, and a lot of other logic that will make it somewhat harder to digest.

If you want to use it "as is" you should be able to call it the way rt^3 calls it (find_package most likely) and just use what it gives you

view this post on Zulip starseeker (Dec 14 2019 at 20:31):

@Jeffrey Liu Depending on how the task is defined, doing it manually in Visual Studio may be enough for the task

view this post on Zulip starseeker (Dec 14 2019 at 20:32):

Elaborate CMake work is only warranted if we're wiring Appleseed into BRL-CAD - going the other way I'd imagine anything that works is fine for a start-up task...

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:34):

Hm, it's true that the task itself doesn't specify how I should be linking BRLCAD, and I assume that the CMake work involved between linking Appleseed into BRLCAD is probably a little different compared to linking BRLCAD into Appleseed.

view this post on Zulip starseeker (Dec 14 2019 at 20:35):

Either way CMake sounds like it's a distraction from the point of this task, so if manually setting it up in Visual Studio works I'd go with it.

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:35):

@Sean could you please help clarify?

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:38):

I can see how I might set it up in Visual Studio - it would probably just be a matter of manually setting up the include and lib directories. However, if part of the task does indeed involve configuring CMake, then I guess I can always go back to it later.

view this post on Zulip starseeker (Dec 14 2019 at 20:39):

right. If you can get it working manually, you'll know you can eventually make the code work with CMake too and that way you can stay focused on the core Appleseed piece

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:39):

Yep, sounds like a plan. Thanks so much for your help!

view this post on Zulip starseeker (Dec 14 2019 at 20:40):

no problem - sorry for the red herrings.

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 20:42):

It's alright, I think they'll come in handy for the future :)

view this post on Zulip Sean (Dec 14 2019 at 21:28):

@Jeffrey Liu yes, the task intentionally does not say anything at all about the build system as it’s not the focus. The focus is strictly on the task objective.

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 21:29):

Oh ok, that makes things a lot simpler. I believe that I've been able to link it correctly manually. As for the task objective itself, how should I be handling the hit/miss callbacks?

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 21:29):

I believe that I'd need to use some obj or database, so could I load in a sphere.obj overlaying the SphereObject?

view this post on Zulip Sean (Dec 14 2019 at 21:30):

However you get it working is fine. I would recommend following the existing cmake in brl-cad or rt^3 as being the easiest and fastest but it still literally does not matter yet.

view this post on Zulip Jeffrey Liu (Dec 14 2019 at 21:35):

I believe that I'd need to use some obj or database, so could I load in a sphere.obj overlaying the SphereObject?

When I say overlay, I just mean load in a sphere object so that the rays from the brlcad raytracing have something to hit/miss. My plan was to, in both intersect() functions, call rt_shootray() with the identical ray information as the appleseed raytracing, and then print out statements within both the hit/miss callbacks.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:48):

Hi @Sean , I've been getting some strange errors from my program but I've been having a lot of difficulty debugging it. So after manually linking the required BRLCAD libraries (which I believe worked successfully, as compiling is successful), appleseed ends up crashing when I try to load in the project. It seems like this happens when bu_log(), bu_exit(), rt_prep_parallel(), and maybe other functions are called.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:49):

Some sort of document named (BRL-CAD)-15072-bomb is created, but all it contains is this:

******************************************

BRL-CAD Release 7.30.3  Crash Report
    Thu, 05 Dec 2019 17:18:30 -0500, Compilation 0
    JeffL@unknown

Command: (BRL-CAD)
Process: 15072
Path: C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\bin\vc141\Ship\appleseed.studio.exe
Date: Sun Dec 15 03:40:46 2019

Call stack backtrace (thread 0):

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:49):

hey jeffrey..

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:49):

Hello

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:50):

my screen is also pink when the sphere is imported from BRL-CAD to appleseed

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:50):

i even set the the material to something

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:51):

@Sumagna Das can you send a screenshot of the application?

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:52):

what should i do

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:53):

Screenshot-from-2019-12-15-14-22-37.png

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:53):

i opened all of the things in the tree

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:53):

so you can tell what should i do

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:53):

Have you linked the materal to the sphere instance? Did you rerender the image afterwards?

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:54):

You might also want to add in a couple other objects, as after the materials are set up properly, the render will be completely dark without any lights.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:57):

Hi Sean , I've been getting some strange errors from my program but I've been having a lot of difficulty debugging it. So after manually linking the required BRLCAD libraries (which I believe worked successfully, as compiling is successful), appleseed ends up crashing when I try to load in the project. It seems like this happens when bu_log(), bu_exit(), rt_prep_parallel(), and maybe other functions are called.

Back to what I was saying, it seems like rt_dirbuild() passes through without error as I was able to print a test statement following the call to rt_dirbuild().

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:57):

i right clicked on the sphere instance, pressed assign materials and assigned it the green material

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:58):

sorry for the delay and interruption but my laptop's keyboard is kind of pressing 4 without my intervention

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 08:59):

Have you tried rerendering?

view this post on Zulip Sumagna Das (Dec 15 2019 at 08:59):

Have you tried rerendering?

umm yea

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:00):

Could you send over your appleseed file then? It'll be easier for me to see your setup.

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:01):

ok

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:02):

Import.appleseed sph.obj the object and file

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:04):

After running appleseed through the VS debugger mode, this is what happens when I attempt to load in the plugin:

Exception thrown at 0x00007FFE0B32A839 in appleseed.studio.exe: Microsoft C++ exception: xercesc_3_2::TraverseSchema::ExceptionCodes at memory location 0x0000002BA4EFDEF0.
'appleseed.studio.exe' (Win32): Loaded 'C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\examples\cpp\art\build\Release\art-plugin.dll'. Module was built without symbols.
'appleseed.studio.exe' (Win32): Unloaded 'C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\examples\cpp\art\build\Release\art-plugin.dll'
Exception thrown at 0x00007FFE0B32A839 in appleseed.studio.exe: Microsoft C++ exception: foundation::ExceptionCannotLoadSharedLib at memory location 0x0000002BA4EFDF48.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:10):

Import.appleseed sph.obj the object and file

@Sumagna Das Alright, so what it seems to me is that, if you look at the sphere instance itself, there is no material assigned to the "back," and since your camera position is starting inside of the sphere, it is still indicating that there is no material.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:12):

It's getting late for me so I'm going to head off for now. Have a nice night (or day)!

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:12):

ok

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:13):

This error is giving me quite the headache... I'm still having difficulty even understanding what exactly is causing the error.

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:15):

so there should be a material assigned to back

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:15):

?

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:15):

Not necessarily, you just need to zoom out enough and the image should turn black (no lights)

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:16):

i became dark as soon as i assigned green material to back

view this post on Zulip Sumagna Das (Dec 15 2019 at 09:16):

how to zoom out

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 09:17):

To be honest I don't remember off the top of my head, but it's one of the first things mentioned in the "getting started" appleseed documentation.

view this post on Zulip starseeker (Dec 15 2019 at 14:06):

Based on that VS message, you're building in Release mode rather than Debug mode

view this post on Zulip Thusal Ranawaka (Dec 15 2019 at 14:11):

Starseeker did you do the Appleseed#1 task?

view this post on Zulip Thusal Ranawaka (Dec 15 2019 at 14:33):

Sumagna did you do the Appleseed #1 task?

view this post on Zulip Chiranjiv Singh Malhi (Dec 15 2019 at 15:13):

d1.PNG d2.PNG Can anyone please help me , whenever i try to build the software i get these errors after following the steps of installation. many of the programs are built but the main mged or archer are not made.

view this post on Zulip Himanshu (Dec 15 2019 at 15:40):

Hey @Daniel Rossberg If I have to bind function in lua so is it also compulsory to implement function of nested class too ?

view this post on Zulip Himanshu (Dec 15 2019 at 15:41):

https://paste.ofcode.org/EnnfVh2qex83cUQU3gQUGB

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:10):

Based on that VS message, you're building in Release mode rather than Debug mode

Hi @starseeker , thank you for pointing that out! I hadn't even realized it. However, even after building in Debug mode, I'm still getting this error:

Exception thrown at 0x00007FFE0B32A839 in appleseed.studio.exe: Microsoft C++ exception: xercesc_3_2::TraverseSchema::ExceptionCodes at memory location 0x0000008D3DCFE3C0.
'appleseed.studio.exe' (Win32): Loaded 'C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\examples\cpp\art\build\Debug\art-plugin.dll'. Symbols loaded.
'appleseed.studio.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'.
'appleseed.studio.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'.
'appleseed.studio.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'.
'appleseed.studio.exe' (Win32): Unloaded 'C:\Windows\System32\msvcp140d.dll'
'appleseed.studio.exe' (Win32): Unloaded 'C:\Windows\System32\vcruntime140d.dll'
'appleseed.studio.exe' (Win32): Unloaded 'C:\Windows\System32\ucrtbased.dll'
'appleseed.studio.exe' (Win32): Unloaded 'C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\examples\cpp\art\build\Debug\art-plugin.dll'

view this post on Zulip starseeker (Dec 15 2019 at 16:17):

I think you need to run a backtrace or break on the exception, but it's been a while since I've done that in MSVC so I don't recall the details

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:18):

When you say backtrace, are you referring to the callstack that visual studio provides?

view this post on Zulip starseeker (Dec 15 2019 at 16:19):

https://docs.microsoft.com/en-us/visualstudio/debugger/debugger-feature-tour?view=vs-2019

view this post on Zulip starseeker (Dec 15 2019 at 16:20):

The message you posted indicates it's gotten an exception and talks about loading dlls, but doesn't give you any history from the source code of how you got to that point

view this post on Zulip starseeker (Dec 15 2019 at 16:21):

I usually develop on Linux, so I'm not terribly good at debugging on Windows, but one thing I know you can do is set breakpoints and single step through the code if need be.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:22):

Hm... this is quite an interesting situation because when debugging appleseed, it opens the appleseed.studio application from which I must load in the project file, which is where the issue arises.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:28):

If you're referring to the issue with the dll, that's the appleseed plugin that I compiled which is causing the issue.

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 16:49):

After running appleseed through the VS debugger mode, this is what happens when I attempt to load in the plugin:

Exception thrown at 0x00007FFE0B32A839 in appleseed.studio.exe: Microsoft C++ exception: xercesc_3_2::TraverseSchema::ExceptionCodes at memory location 0x0000002BA4EFDEF0.
'appleseed.studio.exe' (Win32): Loaded 'C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\examples\cpp\art\build\Release\art-plugin.dll'. Module was built without symbols.
'appleseed.studio.exe' (Win32): Unloaded 'C:\Users\JeffL\Downloads\Google Code-in 2019\Source\appleseed\sandbox\examples\cpp\art\build\Release\art-plugin.dll'
Exception thrown at 0x00007FFE0B32A839 in appleseed.studio.exe: Microsoft C++ exception: foundation::ExceptionCannotLoadSharedLib at memory location 0x0000002BA4EFDF48.

The error message says it all: foundation::ExceptionCannotLoadSharedLib
The appleseed program possibly couldn't find the BRL-CAD DLLs. These are either the brlcad.dll or librt.dll, libbu.dll, etc., depending on which you linked. ropping them into the Appleseed binary directory is the simplest solution.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:51):

My understanding was that the DLL it was referring to was art-plugin.dll, which was my program/plugin. I thought that I statically linked the BRLCAD libraries through the .lib files.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:52):

I was able to resolve the crashing by placing my geometry database in the proper directory - it seems like after failing to load in the database, the application would crash.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 16:55):

Looks like i have a new issue now... rendering ends up crashing the application instead now :(

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 16:58):

My understanding was that the DLL it was referring to was art-plugin.dll, which was my program/plugin. I thought that I statically linked the BRLCAD libraries through the .lib files.

This is not true. The .lib files contain the interface description only. If they belong to a .dll, these files are still necessary as they contain the byte code. Your art-plugin.dll cannot be loaded if they aren't present.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 17:01):

Oh, I wasn't aware of that. Would it not be enough to link the .lib files from the installation directory? I can't seem to find any .dll files there.

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 17:02):

The .dll files are in the bin directory, together with the .exe files.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 17:03):

Oh I see them now, guess I didn't look hard enough. So should I just copy-paste the .dll files I need?

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 17:03):

This tool helps finding missing DLLs: http://www.dependencywalker.com

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 17:04):

Oh I see them now, guess I didn't look hard enough. So should I just copy-paste the .dll files I need?

Yes. All of them to play it safe.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 17:05):

Alright, I will try that. Thanks so much for your help!

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:16):

do i have to submit the screenshot of the output window of rt command in mged for the task appleseed #1(create and render a sphere in BRL-CAD and appleseed)?

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 18:23):

I thing this is meant by "SUBMIT a screenshot of it rendered in BRL-CAD".

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:28):

doesnt rt render the whole thing?

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:30):

btw, how to change the background color of the output window of rt ccommand

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:30):

it is transparent

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:35):

is there any way?

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 18:44):

I know this issue from Linux, but I couldn't find a solution yet. You can set the background color with the "-C" option (e.g. "-C 243/134/17"). But, it will still be transparent. Putting the window in front of the dark mged graphics window helps.

Another possibility is to use the "Raytrace Control Panel" from the "Tools" menu and render it into mged's graphics window.

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:44):

ok

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:44):

you work on linux?

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:47):

@Jeffrey Liu i found out how to zoom out in appleseed and rendered the sphere

view this post on Zulip Daniel Rossberg (Dec 15 2019 at 18:47):

I work on Linux and Windows. At the moment, I'm sitting in front of a Linux machine. But at work I'm developing with Visual Studio on Windows.

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 18:47):

Jeffrey Liu i found out how to zoom out in appleseed and rendered the sphere

Nice!

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:48):

@Jeffrey Liu i found out how to zoom out in appleseed and rendered the sphere

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:48):

why is it sending my message again?

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:50):

I work on Linux and Windows. At the moment, I'm sitting in front of a Linux machine. But at work I'm developing with Visual Studio on Windows.

i have windows and ubuntu on dual boot as my father also takes this laptop to his work sometimes and he cant work with ubuntu

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 18:57):

@Daniel Rossberg I tried what you told me to do and I believe it ended up working - thanks so much for all of your help!

view this post on Zulip Sumagna Das (Dec 15 2019 at 18:59):

hey jeffrey does the rendered version of the sphere needs to have a material or can it be pink(without material) for the appleseed #1 task?

view this post on Zulip Jeffrey Liu (Dec 15 2019 at 19:01):

When I was doing the task, I was told that the main point of the task was just to figure out how to convert a geometry database into an obj file and then import it into appleseed - the materials were not necessarily important. That said, I ended up giving it a material and added lights so that it felt more complete.

view this post on Zulip Sumagna Das (Dec 15 2019 at 19:01):

ok

view this post on Zulip Sumagna Das (Dec 15 2019 at 19:01):

i am sending it without material

view this post on Zulip Sumagna Das (Dec 15 2019 at 19:02):

if the mentors send it back and tell me to add material, i will add one

view this post on Zulip Sumagna Das (Dec 15 2019 at 19:03):

kind of a trial-and-error method

view this post on Zulip Jeffrey Liu (Dec 16 2019 at 20:40):

Hi @Sean , I'm just getting started on task #6 of Appleseed. If I'm interpreting correctly, is the point of this task to detect the geometry database information with BRLCAD and then provide that information to Appleseed so that it can render it?

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 00:22):

I'm getting a weird error when I call rt_shootray() too many times... the first time I got like a Debug Assertion Error with something related to debug_heap.cpp, and now appleseed is just crashing when I try to render with the plugin.

view this post on Zulip Erik (Dec 17 2019 at 00:29):

whack it with a debugger. Also; watch memory consumption, you may have a leak.

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 00:30):

I think it might have something to do with a leak, but I'm not sure if I can do anything about it, because as far as I know it's getting caused by a function that I don't really have much control over.

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 00:33):

I'm having a bit of trouble debugging it because I'm running appleseed.studio, and then the error comes when I try to render using the dll I compiled. Could you help me figure out how to properly debug it?

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 04:32):

Reading the past chat, it seems like I have the same issue as Jeff - appleseed's threading vs brlcad's threading is causing the crash. I will see what I can do solve this.

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:03):

I feel like I'm close... when I call ap_a_resource->re_cpu I'm getting outputs from 0-3, but rendering is still crashing.

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:07):

Rendering is really inconsistent, one time a single tile got rendered before crashing. At least that means some sort of progress has been made though?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:37):

anyone here?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:37):

what is the VSET function for?

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:39):

@Sumagna Das From what I can tell, VSET is used to set the origin and direction of the ray being shot, hence the ap.a_ray.r_dir and ap.a_ray.r_pt.

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:39):

ok

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:40):

but to shoot a grid of rays, i have to make which part a variable?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:40):

where is the prototype of VSET function?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:40):

i will see there what to do

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:40):

raytrace.h?

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:41):

Update on my progress: it is indeed some sort of threading issue because when I use the appleseed command-line version and set the number of threads to only 1, rendering outputs an image although it's still not a correct image :(

view this post on Zulip Sean (Dec 17 2019 at 06:41):

it's not a function, it's a macro -- defined in vmath.h

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:42):

thanks

view this post on Zulip Sean (Dec 17 2019 at 06:42):

Hi Sean , I'm just getting started on task #6 of Appleseed. If I'm interpreting correctly, is the point of this task to detect the geometry database information with BRLCAD and then provide that information to Appleseed so that it can render it?

Essentially yes, render a given bit of brl-cad geometry using librt, but from within appleseed (still using their procedural api)

view this post on Zulip Sean (Dec 17 2019 at 06:43):

if you spend more than a couple hours, just report out where you're at and what you have and don't have working, and we can think about where to go from there

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:44):

VSET( ap.a_ray.r_dir, 0, 0, -1 );

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:44):

what does this line mean?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:45):

why -1?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:45):

ok got it

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:46):

Welp I've spent quite a few hours so far, so I guess I can report: similar to the issue Jeff was facing 2 years ago, appleseed still crashes when I try to render. It is definitely a threading issue because when I run appleseed.cli on a single thread, an image gets output (I still need to work on that). I'm not really sure where to go from here because I tried setting up the resources (and ap->a_resource->re_cpu outputs various ints) but it is still crashing.

view this post on Zulip Sean (Dec 17 2019 at 06:48):

what does this line mean?

It's setting the ray direction to a vector with i/j/k components set to 0.0, 0.0, -1.0 --- that is, the ray is pointing "down"

view this post on Zulip Sean (Dec 17 2019 at 06:48):

specifically, down the Z axis

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:48):

ok

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:49):

VSET( ap.a_ray.r_pt, 0, 0, 10000 );

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:49):

As for the rendering itself, I believe I'm transferring the ray information correctly, but there's quite a few things that I think could go wrong. For example, I'm returning ap->a_ray_length as the distance, but I have no idea if the units are even the same. Other things that I could be doing incorrectly are setting the UVs and the bounding box.

view this post on Zulip Sean (Dec 17 2019 at 06:49):

so this is like looking from a "top" view in mged (just type top or "t" in the graphics window)

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:49):

this sets the position of the ray point, right?

view this post on Zulip Sean (Dec 17 2019 at 06:49):

right

view this post on Zulip Sean (Dec 17 2019 at 06:49):

the starting point

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:50):

so if i have to shoot a grid of rays i have to change x and y value to something else

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:50):

right?

view this post on Zulip Sean (Dec 17 2019 at 06:51):

@Jeffrey Liu there is a librt routine that will return the bounding box size (or you can call ged_bb() to get it more easily)

view this post on Zulip Sean (Dec 17 2019 at 06:52):

@Sumagna Das for that particular ray, you'd need to change r_pt to a bunch of different X and Y values (keeping Z at 10000)

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:52):

ok

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:52):

now i understand what the appleseed task 2 wants to imply

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:53):

can i use the rtexample.c file as a base?

view this post on Zulip Sean (Dec 17 2019 at 06:53):

of course, I think the task even says so doesn't it?

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:53):

ok

view this post on Zulip Sean (Dec 17 2019 at 06:53):

read the task, but all of brl-cad is sample code you can reference

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:54):

i can even take the x and y to negative values, right?

view this post on Zulip Sean (Dec 17 2019 at 06:54):

tasks aren't hard for the sake of being hard ... use the source to help you understand

view this post on Zulip Sean (Dec 17 2019 at 06:54):

X, Y, and Z can be any real value, positive or negative, for r_pt

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:54):

probably have to get VSET into a for loop

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:55):

or any loop

view this post on Zulip Sean (Dec 17 2019 at 06:55):

now r_dir can too, but only the normalized result is going to get used

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:56):

r_dir can also be changed, are you trying to say?

view this post on Zulip Sean (Dec 17 2019 at 06:56):

VSET, VMOVE, ... lots of ways

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:56):

ok

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:56):

Jeffrey Liu there is a librt routine that will return the bounding box size (or you can call ged_bb() to get it more easily)

Would I need to include an extra header to call ged_bb()? It says that this function does not exist at the moment.

view this post on Zulip Sean (Dec 17 2019 at 06:57):

it can, but then you're changing the direction of the ray. that's not probably something you want to do at this point, but should try to understand

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:57):

yes

view this post on Zulip Sean (Dec 17 2019 at 06:57):

gotta run, good luck. keep asking questions but try to learn independently too

view this post on Zulip Sean (Dec 17 2019 at 06:57):

lil balance of both

view this post on Zulip Sumagna Das (Dec 17 2019 at 06:57):

thanks

view this post on Zulip Jeffrey Liu (Dec 17 2019 at 06:58):

Welp I've spent quite a few hours so far, so I guess I can report: similar to the issue Jeff was facing 2 years ago, appleseed still crashes when I try to render. It is definitely a threading issue because when I run appleseed.cli on a single thread, an image gets output (I still need to work on that). I'm not really sure where to go from here because I tried setting up the resources (and ap->a_resource->re_cpu outputs various ints) but it is still crashing.

As for this issue @Sean , would it be alright if I rendered on a single thread for this task?

view this post on Zulip Thusal Ranawaka (Dec 17 2019 at 07:19):

I m resubmitting the screenshot and the project please review, Sean

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:15):

I feel like I'm so close to rendering the .g file (still on a single thread though)... This is what I have so far (rendering sphere.g) pasted image

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:16):

As of right now, the two biggest issues I'm facing are the UVs and the viewport.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:19):

I believe there is a component to the appleseed result that requires the object's UV coordinate at the point where the ray intersects it, but I'm struggling to find if/where this is stored through BRLCAD raytracing. I'm like 70% sure that's what's causing the weird visual bug on the sphere because I'm currently using the UV calculations done by the example sphereobject.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:25):

The other issue I'm facing is the viewport, as the traditional appleseed viewport mechanics (rotating, scrolling, zooming) have some really weird effects when I try to do it when rendering the geometry. My best guess, which might be totally wrong, is that there's some sort of discrepancy between BRLCAD and appleseed in terms of perspective/orthographic projection. I believe appleseed uses perspective projection while BRLCAD uses orthographic projection, but I'm not sure exactly how that would affect the result and I couldn't test the difference because I haven't figured out how to change the setting for either one.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:27):

I'm a bit stuck at the moment... could someone help me?

view this post on Zulip Sean (Dec 18 2019 at 02:28):

you are looking super close...

view this post on Zulip Sean (Dec 18 2019 at 02:28):

I can help you in a few minutes. Have to finish up something first.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:29):

Alright, thanks so much!

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 02:30):

An update on the visual glitch: it might not be a result of the UVs, since I hardcorded the coordinates to (1.0, 1.0) given that the object should just be a solid color, but the artifacts still exist.

view this post on Zulip Sean (Dec 18 2019 at 03:40):

@Jeffrey Liu hm, yeah, my first thought on the X pattern is that it's either UVs or input/output hit ordering

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 03:41):

When you say input/output hit ordering, are you referring to the exit point?

view this post on Zulip Sean (Dec 18 2019 at 03:41):

sorry, I meant in/out hit points

view this post on Zulip Sean (Dec 18 2019 at 03:42):

the out would be an exit point, yes

view this post on Zulip Sean (Dec 18 2019 at 03:42):

if the intersection callback is using the wrong point, you could be looking at the "inside" of the sphere in parts

view this post on Zulip Sean (Dec 18 2019 at 03:42):

unlikely but it's possible

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 03:45):

I did consider that as a possible source of error, but I set ap->a_onehit = 1 (is that the correct way to stop the ray after the first intersection?). It might still be the case where the ray somehow just passes through the front of the object and hits the back of the object though.

view this post on Zulip Sean (Dec 18 2019 at 03:47):

it is the correct way, but multiple points can still be returned so you have to make sure you're using the in_hit, not the out_hit of the partition

view this post on Zulip Sean (Dec 18 2019 at 03:48):

as you're shooting a sphere, in and out points are calculated simultaneously, so a_onehit doesn't really do anything.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 03:49):

Oh I didn't know that, thanks for the insight! However, I'm pretty sure I'm using the in_hit (hitp = pp->pt_inhit;) correctly?

view this post on Zulip Sean (Dec 18 2019 at 03:50):

yep, that looks right

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 03:51):

Hm, then it might be another issue. Could I send you the code that I have right now? Perhaps there's some glaring error that I've failed to notice.

view this post on Zulip Sean (Dec 18 2019 at 03:51):

of course, post it up

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 03:52):

art-plugin.cpp

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 03:53):

I'm not really sure if the struct I made would be the best solution for what I'm doing, but it works for the time being I think.

view this post on Zulip Sean (Dec 18 2019 at 03:59):

so FYI, this is like 2-3 GCI tasks worth of effort :)

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:00):

Wait, did I end up doing too much?

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:01):

Or do you mean that this task is just relatively difficult?

view this post on Zulip Sean (Dec 18 2019 at 04:02):

you can't do to much. it's what GCI is all about.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:03):

Oh oops, that's a bit awkward... So what should I do? Submit what I have?

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:03):

I would like to figure out what's causing these issues though...

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:03):

But that can come later I guess

view this post on Zulip Sean (Dec 18 2019 at 04:04):

but yeah, this is a hard task and even then you've still gone beyond the required with some parts needed for parallel (though looks like you have a bug there)

view this post on Zulip Sean (Dec 18 2019 at 04:04):

well let's see if we can figure out what's wrong

view this post on Zulip Sean (Dec 18 2019 at 04:05):

you can submit and it's good enough for #6 but probably not enough for the later task where you create an appleseed renderer

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:05):

Yeah, rendering using multithreading still ended up crashing. I asked Franz about it and he told me:

indeed
there's just no way around it, if you want to render on multiple threads, whatever code you call in intersect() must be thread-safe, by definition
unless you add a lock in intersect(), but then performance will suffer, possibly quite dramatically

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:07):

you can submit and it's good enough for #6 but probably not enough for the later task where you create an appleseed renderer

Ok thank you :) I will do that and then try to figure out what's causing the error. Would you still want me to include the render with the visual bug?

view this post on Zulip anshu khare (Dec 18 2019 at 04:08):

Screenshot-from-2019-12-18-09-35-59.png

view this post on Zulip Sean (Dec 18 2019 at 04:08):

rt_shootray() is thread-safe, so it can be made to work, you just not doing the right initialization and the id method might need some help

view this post on Zulip Sean (Dec 18 2019 at 04:08):

but that's not a critical problem. single threaded first.

view this post on Zulip anshu khare (Dec 18 2019 at 04:09):

I am stuck here..someone please help..

view this post on Zulip Sean (Dec 18 2019 at 04:09):

I am stuck here..someone please help..

it doesn't look like your problem has anything to do with appleseed. you should post on a different subject in #Google Code-in

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:11):

Maybe it's the way I'm accessing/setting the information? I'm not very familiar with threading but perhaps it's because of the way I'm setting ap->a_ray.r_dir and ap->a_ray.r_pt in intersect().

view this post on Zulip Sean (Dec 18 2019 at 04:11):

why are you normalizing the ray?

view this post on Zulip Sean (Dec 18 2019 at 04:12):

also, what's the difference between the DETAILED and SIMPLE intersect methods?

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:13):

I might be remembering incorrectly, but I thought ap->a_ray.m_dir only used normalized vectors.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:14):

also, what's the difference between the DETAILED and SIMPLE intersect methods?

So I asked the same question to the appleseed discord, and the best explanation I got was: the SIMPLE one returns a boolean used for shadow rays, where you only need to know if the ray was blocked, while the DETAILED one is used for all other rays where more information (hit point, normal, etc) are necessary.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:19):

^^ that's why for the SIMPLE method, i just checked the return of rt_shootray() to see if it was a hit or miss.

view this post on Zulip Sean (Dec 18 2019 at 04:24):

@Jeffrey Liu so a few suggestions, comments, things I notice

view this post on Zulip Sean (Dec 18 2019 at 04:26):

your brlcad_hit routine seems peculiar. don't know for sure without stepping through a test, but I don't think you need or want to iterate over partitions. you just want the hit point returned.

view this post on Zulip Sean (Dec 18 2019 at 04:27):

also, you calculate and stash the normal, but you probably shouldn't - you can do that in intersect() after rt_shootray() only if it's successful

view this post on Zulip Sean (Dec 18 2019 at 04:30):

try adding a break; after line 91

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:30):

your brlcad_hit routine seems peculiar. don't know for sure without stepping through a test, but I don't think you need or want to iterate over partitions. you just want the hit point returned.

Ah that makes sense, I should've looked at it more carefully - most of my hit call was taken from the rtexample method.

view this post on Zulip Sean (Dec 18 2019 at 04:31):

there should be only one partition with a simple sphere, but easy enough to test

view this post on Zulip Sean (Dec 18 2019 at 04:31):

yeah, rtexample iterates over everything because it's going to print all the hit information

view this post on Zulip Sean (Dec 18 2019 at 04:31):

you don't want all that, you just want the first hit

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:32):

Alright I'll try that, thanks for the advice! To be honest I wasn't really aware of what exactly the purpose of the loop was beforehand.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:33):

As for the normals, wouldn't it only be called in the hit callback, meaning that rt_shootray() is successful? Unless I'm neglecting to account for something?

view this post on Zulip Sean (Dec 18 2019 at 04:37):

yes, only called in the hit callback, but then you're stashing a normal there

view this post on Zulip Sean (Dec 18 2019 at 04:38):

if there are multiple partitions, you'll end up stashing the last normal instead of the first because of the looping

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:38):

Oh right. So the break should fix that issue. In this case the looping will never be needed, right?

view this post on Zulip Sean (Dec 18 2019 at 04:42):

right

view this post on Zulip Sean (Dec 18 2019 at 04:42):

did you confirm that compute_local_bbox() is the right box?

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:43):

No, I didn't, I wasn't really sure how to.

view this post on Zulip Sean (Dec 18 2019 at 04:43):

just print it :)

view this post on Zulip Thusal Ranawaka (Dec 18 2019 at 04:44):

HELLO I submit my task yesterday noon so kindly request for review it whenever time you got.

view this post on Zulip Sean (Dec 18 2019 at 04:44):

@Thusal Ranawaka your comment has absolutely nothing to do with Appleseed, so you should be posting to a different topic

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:45):

just print it :)

Ah right, good idea

view this post on Zulip Sean (Dec 18 2019 at 04:48):

HELLO I submit my task yesterday noon so kindly request for review it whenever time you got.

is your pending for an appleseed task?

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:48):

One question about local bounding boxes: I can see how a box might be computed in the case where there's a single lowest point and a single highest point, but how is this handled when the bounding box is exactly horizontal?

view this post on Zulip Sean (Dec 18 2019 at 04:51):

not understanding your question

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:51):

This is what was output: Local Bounding Box: (-1.000000, -1.000000, -1.000000) , (1.000000, 1.000000, 1.000000). I'm exactly sure if this is correct because the sphere has a radius of 0.4mm

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:53):

not understanding your question

Sorry, now that I think about it, I was just wondering how a bounding box is calculated and how it's used. I noticed that the appleseed AABB constructor only took in two vector arguments, but I don't understand how this is enough information to create a bounding box.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:54):

It's a bit irrelevant, but I was just curious. Maybe I am doing something incorrect with the bounding box?

view this post on Zulip Sean (Dec 18 2019 at 04:54):

a box can be formed by two vectors or two points

view this post on Zulip Sean (Dec 18 2019 at 04:54):

min/max points

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 04:56):

Right, that's what I was thinking, where the box lengths would just be the differences between the vector components, but what about in cases where, for example, the min/max points only differ in a single component (one is directly above the other)?

view this post on Zulip Sean (Dec 18 2019 at 05:02):

that'd be a degenerate case, typically is detected or compensated elsewhere in graphics codes

view this post on Zulip Sumagna Das (Dec 18 2019 at 14:43):

anyways i saw task 7 of the appleseed series.(i am not gonna start it now but after and if i complete the previous tasks)

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 14:57):

Regarding the changes I made with the loop - unfortunately, the render still output the visual bug. I asked Franz about it and he said it was likely the result of busted normals or self-intersections.

view this post on Zulip Jeffrey Liu (Dec 18 2019 at 14:58):

He gave me some tips on how I could check/fix these errors, so I'll try working on them soon.

view this post on Zulip Sean (Dec 19 2019 at 02:51):

@Jeffrey Liu that was why my second suggestion was to pull the normal setting outside of the hit routine

view this post on Zulip Sean (Dec 19 2019 at 02:52):

it could also still be the uv parameterization, but less likely

view this post on Zulip Sean (Dec 19 2019 at 02:52):

that shouldn't come into play unless we do texturing

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:34):

Hm, franz pointed me towards the "Override Shading" option to view the normals by themselves, which looks like this pasted image

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:35):

They seem smooth and there aren't any inconsistencies where the actual artifacts are occurring, so perhaps the issue is caused by something else?

view this post on Zulip Sean (Dec 19 2019 at 03:35):

actually that pretty much confirms it's not the normals

view this post on Zulip Sean (Dec 19 2019 at 03:36):

but that's pretty exciting. can you open an arbitrary .g file now? looked in the code like you can...

view this post on Zulip Sean (Dec 19 2019 at 03:37):

if you can, try that on something more interesting like havoc in havoc.g :)

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:37):

I'll try, I haven't tested anything besides a sphere.

view this post on Zulip Sean (Dec 19 2019 at 03:37):

/me does a drumroll...

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:42):

Hopefully the camera settings work out, there's still that issue with the viewport so it might be hard to actually focus on what I need to. I'm still rebuilding (I should really allow custom paths later), but I don't see why the geometry wouldn't load.

view this post on Zulip Sean (Dec 19 2019 at 03:43):

bounding box, however that is calculated might be the only issue

view this post on Zulip Sean (Dec 19 2019 at 03:44):

but the fact that you're using the model min/max is good, seems right

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:44):

Oh right, that still hasn't been completely confirmed yet

view this post on Zulip Sean (Dec 19 2019 at 03:45):

well, it will be more interesting for havoc

view this post on Zulip Sean (Dec 19 2019 at 03:45):

sphere is unusual just because it's so tiny

view this post on Zulip Sean (Dec 19 2019 at 03:45):

I suspect it's still something wrong with the hit points themselves in the intersect() function

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:46):

Darn, looks like nothing is rendering but I'm not sure if it's because of the camera settings or because of the geometry loading.

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:47):

On the other hand, this was output:

Database title: BRL-GSI Paris Air Show Soviet HAVOC Helicopter
Configuring complete!
Local Bounding Box: (-760.000000, -8438.000000, -890.000000) , (19125.000000, 8398.000000, 5360.000000)
Local Bounding Box: (-760.000000, -8438.000000, -890.000000) , (19125.000000, 8398.000000, 5360.000000)
Local Bounding Box: (-760.000000, -8438.000000, -890.000000) , (19125.000000, 8398.000000, 5360.000000)
Local Bounding Box: (-760.000000, -8438.000000, -890.000000) , (19125.000000, 8398.000000, 5360.000000)
Local Bounding Box: (-760.000000, -8438.000000, -890.000000) , (19125.000000, 8398.000000, 5360.000000)

view this post on Zulip Sean (Dec 19 2019 at 03:47):

That looks right

view this post on Zulip Sean (Dec 19 2019 at 03:48):

so probably camera settings. if it was anywhere near the sphere, you'd need to be zoomed way way out

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:49):

I'll play around with it and see if anything shows up

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:52):

well, I found something after changing the location of the camera from 10 all the way to 10000: pasted image

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:52):

As expected, the viewport controls are really messed up though

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:54):

It also looks like the weird darkspots still exist

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 03:55):

That's exciting though, I'm happy to see that at least part of my code worked properly :)

view this post on Zulip Sean (Dec 19 2019 at 04:07):

awesome!

view this post on Zulip Sean (Dec 19 2019 at 04:09):

that's way cool, though. clearly shows it rendering the helicopter

view this post on Zulip Sean (Dec 19 2019 at 04:09):

the viewport isn't messed up, it's rotated

view this post on Zulip Sean (Dec 19 2019 at 04:10):

appleseed is using +Y up instead of +Z up, so you'll need to apply a 90-degree rotation when you open geometry

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:11):

That too, but trying to do CTRL + RIGHT/LEFT/MIDDLE mouse is giving some really weird effects - it should just be rotating, panning, and zooming, but it's being affected in other ways as well for some reason.

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:12):

appleseed is using +Y up instead of +Z up, so you'll need to apply a 90-degree rotation when you open geometry

That makes a lot of sense, is there a function I should call to do so?

view this post on Zulip Sean (Dec 19 2019 at 04:27):

there is a way, but it'll take me a sec to look it up. it's not important for now

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:32):

Alright, I think the two main issues I have right now are the weird dark spots and the viewport controls (I'm positive that when I'm rendering .g, the rotating/panning/zooming feels much less intuitive than it did before, but I don't know what might be causing this)

view this post on Zulip Sean (Dec 19 2019 at 04:40):

franz have any insights on the controls?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:40):

I haven't asked him about it yet, but I will do it now.

view this post on Zulip Sean (Dec 19 2019 at 04:49):

@Jeffrey Liu it very well could be the default navigation method, could be a method that works to keep 'up' pointing up

view this post on Zulip Sean (Dec 19 2019 at 04:49):

in which case, the fix will be to fix the rotation

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:50):

Oh, so the issue involving the +y and +z might actually be causing the viewport issues as well?

view this post on Zulip Sean (Dec 19 2019 at 04:50):

yep

view this post on Zulip Sean (Dec 19 2019 at 04:50):

there are different kinds of viewport controls he could be using

view this post on Zulip Sean (Dec 19 2019 at 04:51):

one of the more intuitive ones relies on 'up'

view this post on Zulip Sean (Dec 19 2019 at 04:51):

wouldn't be surprised at all if that was at least related

view this post on Zulip Sean (Dec 19 2019 at 04:51):

a real simple test would be to simply swap your values being reported back to appleseed

view this post on Zulip Sean (Dec 19 2019 at 04:52):

swap Z and Y everywhere and negate Y

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:52):

Ok, I'll try testing that right now. Thanks so much for the advice!

view this post on Zulip Sean (Dec 19 2019 at 04:53):

not sure about the bounding box, but it probably needs the same treatment

view this post on Zulip Sean (Dec 19 2019 at 04:54):

so it becomes return asr::GAABB3(asr::GVector3(rtip->mdl_min[X], rtip->mdl_min[Z], -rtip->mdl_min[Y]),
asr::GVector3(rtip->mdl_max[X], rtip->mdl_max[Z], -rtip->mdl_max[Y]));

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 04:56):

Doing this would also fix the geometry rotation as well, right?

view this post on Zulip Sean (Dec 19 2019 at 04:56):

if you do it everywhere and don't make a mistake, it should :)

view this post on Zulip Sean (Dec 19 2019 at 05:02):

note some of them will require some restructuring like the normals

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:03):

Yep, I had to change the normal translation as well; does this look correct?

brlcad_ray_info.normal[0] = inormal[0];
brlcad_ray_info.normal[1] = inormal[2];
brlcad_ray_info.normal[2] = -inormal[1];

view this post on Zulip Sean (Dec 19 2019 at 05:03):

I think so

view this post on Zulip Sean (Dec 19 2019 at 05:05):

all of these should get tested and confirmed with something like the axis example model

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:05):

Oops, it looks like the havoc object is now upside-down, but the controls are working normally again :)

view this post on Zulip Sean (Dec 19 2019 at 05:06):

negate Z instead of Y then

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:08):

It worked like a charm

view this post on Zulip Sean (Dec 19 2019 at 05:08):

screenshot?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:10):

Oops it looks like my normals are inverted now, but it's looking like this now: pasted image

view this post on Zulip Sean (Dec 19 2019 at 05:10):

woo hoo!

view this post on Zulip Sean (Dec 19 2019 at 05:12):

normals are inverted? they don't look to be in that image

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:13):

I think so, when I first loaded the object it was completely pink but I fixed it by setting the back material to the same as the front. I took a look at the shading normals override and it did look a little odd to me

view this post on Zulip Sean (Dec 19 2019 at 05:13):

you should let it render higher quality for a bit, see how nice it can get in a couple minutes

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:13):

Yep that's what I'm doing right now

view this post on Zulip Sean (Dec 19 2019 at 05:14):

you negated Z instead of Y, right?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:14):

I changed the normal code to this:

brlcad_ray_info.normal[0] = inormal[0];
brlcad_ray_info.normal[1] = -inormal[2];
brlcad_ray_info.normal[2] = inormal[1];

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:15):

This is what the overrided shading normals looks like, but to be honest I have no idea if this is correct or not: pasted image

view this post on Zulip Sean (Dec 19 2019 at 05:15):

make sur you don't flip it again where you used brlcad_ray_info

view this post on Zulip Sean (Dec 19 2019 at 05:16):

yeah, something is off

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:17):

When I use brlcad_ray_info.normal again, I'm just normalizing it before assigning it, so it might be something else?

view this post on Zulip Sean (Dec 19 2019 at 05:17):

the hard line on the wheel looks no good

view this post on Zulip Sean (Dec 19 2019 at 05:19):

just guessing, but based on the picture, it looks like it's wrong across Y

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:20):

Hm, should i try inverting Y as well?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:21):

That does seem to be the case: when I reload the project, the surfaces with normals that have no y-component are still rendering with a material while the rest become pink

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:24):

So this is what generates the proper normals:

brlcad_ray_info.normal[0] = inormal[0];
brlcad_ray_info.normal[1] = inormal[2];
brlcad_ray_info.normal[2] = -inormal[1];

But that's weird though, aren't I only inverting Y in this case while I've been inverting Z everywhere else?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:27):

Ok I'm starting a final render now, seems like it might take a while but it's looking quite promising.

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:34):

Here it is in all of its "final" glory: render.png I wish I added a light source so the shading wouldn't be so flat...

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:35):

It looks pretty good otherwise, except for that weird black triangle - I'll try to figure out what's causing it.

view this post on Zulip Sean (Dec 19 2019 at 05:37):

that's looking really good!

view this post on Zulip Sean (Dec 19 2019 at 05:37):

but yeah, looks like there's a couple errors, and that's almost certainly related to whatever is wrong on the sphere case

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:37):

It looks like there's something weird with this normal specifically: pasted image

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:42):

Interestingly, though, the sphere now renders correctly! pasted image

view this post on Zulip Sean (Dec 19 2019 at 05:43):

huh, so that's intresting

view this post on Zulip Sean (Dec 19 2019 at 05:47):

I bet it was the normals then, I think that makes sense -- since we use +Z up, the normals being returned would have been wrong per the camera. they needed to be rotated or the geometry needed to be rotated. curious. what if you restore inormal to 0/1/2 without negation, what's that do?

view this post on Zulip Sean (Dec 19 2019 at 05:48):

it may be right as-is, but want to make sure we're not seeing a mirror

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:49):

Yep it seems like the normals were the issue, this is what it looks like when I changed it back: pasted image

view this post on Zulip Sean (Dec 19 2019 at 05:49):

by the way, that air intake doesn't terribly wrong .. just odd in the middle. here's the normals as we know them: Screen-Shot-2019-12-19-at-12.41.58-AM.png Screen-Shot-2019-12-19-at-12.41.19-AM.png

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:50):

Oh, so there was something off to begin with?

view this post on Zulip Sean (Dec 19 2019 at 05:50):

it's not off

view this post on Zulip Sean (Dec 19 2019 at 05:51):

it's some sort of shielded air intake, so we're seeing a dark shadow inside

view this post on Zulip Sean (Dec 19 2019 at 05:52):

it's a little suspicious that appleseed is rendering it that dark, but not implausible

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 05:52):

Oh ok, sorry about the misunderstanding

view this post on Zulip Sean (Dec 19 2019 at 06:06):

heh, no worries, this is fantastic progress

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:09):

Thanks! Having everything finally come together (for the most part) is super satisfying.

view this post on Zulip Sean (Dec 19 2019 at 06:11):

did you figure out what was wrong with the parallelism?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:11):

Thanks so much for your help by the way :) I wasn't aware of the appleseed +Y up and BRLCAD +Z up at all, which ended up being the factor that was causing almost all of the errors.

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:11):

did you figure out what was wrong with the parallelism?

Unfortunately not yet, I'm still rendering everything on a single thread.

view this post on Zulip Sean (Dec 19 2019 at 06:11):

yeah, appleseed's doing it wrong, but not surprising given which tools he typically integrates with ;)

view this post on Zulip Sean (Dec 19 2019 at 06:13):

movie industry obsessively uses +Y up as the focus is on the "screen" you're looking at, not the world behind the screen

view this post on Zulip Sean (Dec 19 2019 at 06:14):

CAD modeling industry pretty universally uses +Z for up as that makes the most sense for the geometry itself. it's the coordinate frame of the world in nearly all other contexts.

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:14):

Ah, I see. I believe that OpenGL uses a similar coordinate system as well, right?

view this post on Zulip Sean (Dec 19 2019 at 06:14):

Z is altitude/height

view this post on Zulip Sean (Dec 19 2019 at 06:15):

opengl doesn't use anything, you specify it

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:15):

Some of the calculations do seem a little weird at times when the +Y is pointing up

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:15):

Oh, it might've been the way I learned it then.

view this post on Zulip Sean (Dec 19 2019 at 06:16):

quite likely

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:19):

Ok It's getting pretty late for me now, so I'm going to head off. I think I might do a couple other tasks before returning to appleseed #7, but I hope to finish the whole task set as soon as I can.

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 06:19):

Have a good night!

view this post on Zulip Sean (Dec 19 2019 at 06:19):

yeah, I would recommend taking a break after this recent set :)

view this post on Zulip Sean (Dec 19 2019 at 06:19):

great work jeffrey

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 15:25):

Thank you :)

view this post on Zulip Sumagna Das (Dec 19 2019 at 15:37):

can anyone tell me why the build of appleseed is giving me errors( i am building it from the source for task 2)

view this post on Zulip Sumagna Das (Dec 19 2019 at 15:39):

jeffrey any help?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 15:44):

Can you send some screenshots/logs?

view this post on Zulip Sumagna Das (Dec 19 2019 at 15:44):

wait let me try to fix it

view this post on Zulip Sumagna Das (Dec 19 2019 at 15:44):

is that ok with you?

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 15:59):

Sure

view this post on Zulip Sumagna Das (Dec 19 2019 at 15:59):

i had to comment a line to make it work

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:01):

(deleted)

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:01):

now its kinda working

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:09):

this-line.png

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 16:12):

Oh right, you're on Linux. Did you follow their instructions exactly as stated?

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:12):

yes

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 16:13):

It seems like that line is pretty important, commenting it out will probably lead to some unwanted effects

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:13):

but while building the linux deps of appleseed, it didnt build

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:13):

means the build failed

view this post on Zulip Jeffrey Liu (Dec 19 2019 at 16:14):

Which deps?

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:15):

https://github.com/appleseedhq/linux-deps

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:15):

this one

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:16):

(deleted)

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:16):

it is building properly

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:17):

but before it gave me some issues

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:17):

or warnings

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:18):

warnings

view this post on Zulip Sumagna Das (Dec 19 2019 at 16:18):

the other warnings are similar

view this post on Zulip Jeffrey Liu (Dec 20 2019 at 01:17):

Hmm... going off the "files in some directories in conflict with libraries in implicit directories," I think that means you already have an installed version of said library.

view this post on Zulip Sumagna Das (Dec 21 2019 at 19:05):

in this task, we have to do a similar thing like the previous task(B&W image)?

view this post on Zulip Sumagna Das (Dec 22 2019 at 15:25):

hey @Sean am i supposed to achieve something similar to the appleseed #2 in appleseed #3 task? (lika black and white image or something)

view this post on Zulip Sumagna Das (Dec 22 2019 at 15:26):

hey @Erik can you help me with my query?

view this post on Zulip Sumagna Das (Dec 22 2019 at 15:59):

btw @Sean , this link is not working so what should i look to as a base?

view this post on Zulip Sumagna Das (Dec 22 2019 at 16:00):

https://github.com/appleseedhq/appleseed/blob/master/sandbox/samples/cpp/basic/basic.cpp

view this post on Zulip Sumagna Das (Dec 22 2019 at 16:06):

erik?

view this post on Zulip Jeffrey Liu (Dec 22 2019 at 16:10):

@Sumagna Das basic was renamed to helloworld

view this post on Zulip Jeffrey Liu (Dec 22 2019 at 16:12):

Taking a look at it should answer your question about what you should be doing

view this post on Zulip Sumagna Das (Dec 22 2019 at 16:16):

thanks

view this post on Zulip Sumagna Das (Dec 22 2019 at 16:16):

for pointing it out

view this post on Zulip Thusal Ranawaka (Dec 22 2019 at 16:20):

Hello Vikram.

view this post on Zulip Thusal Ranawaka (Dec 22 2019 at 16:22):

How many tasks have you done Vikram?

view this post on Zulip Jeffrey Liu (Dec 22 2019 at 16:24):

No problem!

view this post on Zulip Jeffrey Liu (Dec 22 2019 at 16:40):

(deleted)

view this post on Zulip Vikramaditya Singh (Dec 22 2019 at 16:43):

Kind of just started. Getting familiar with this software. Any helpful links?

view this post on Zulip Thusal Ranawaka (Dec 22 2019 at 16:44):

Vikram do the install task first and do the tutorial tasks

view this post on Zulip Vikramaditya Singh (Dec 22 2019 at 16:45):

Was doing that only. Thanks.

view this post on Zulip Thusal Ranawaka (Dec 22 2019 at 16:47):

[EVERYONE] Learn basic 3D modeling using BRL-CAD type this in the search bar then you will be guided.

view this post on Zulip Vikramaditya Singh (Dec 22 2019 at 16:49):

Generally asking, how demanding is this competition with respect to time? Also, is this software harder to use than Solidworks or Fusion 360?

view this post on Zulip Jeffrey Liu (Dec 22 2019 at 17:04):

I don't mean to be rude, but could you guys move the conversation to another channel? @Vikramaditya Singh I will answer your question somewhere else so that it doesn't interfere with the appleseed channel

view this post on Zulip Zyu (Dec 23 2019 at 20:24):

Hey everyone,

I just figured that you linked the appleseed Slack channel in at least one Google Code In task (https://codein.withgoogle.com/tasks/6101955286401024/?sp-organization=4884012200361984).
Unfortunately, the appleseed people don't use Slack anymore. Instead, they moved to their own Discord Server.
If you want to update the Google Code In task, here is the link to their discord: https://discord.gg/dNCE5J8 (taken from the appleseed website).

Cheers,
Zyu

view this post on Zulip Sumagna Das (Dec 24 2019 at 06:50):

hey @Sean my appleseed is not building so can i use the example from the installation as a base and write a program fof task #3(i am still working on it)

view this post on Zulip Sumagna Das (Dec 24 2019 at 06:52):

i am trying to build it but it is not building correctly

view this post on Zulip Sumagna Das (Dec 24 2019 at 07:08):

is the task similar to task 2(i can use the helloworld file as a base )?

view this post on Zulip Sean (Dec 24 2019 at 07:23):

If you want to update the Google Code In task, here is the link to their discord: https://discord.gg/dNCE5J8 (taken from the appleseed website).

Thanks @Zyu ! Task description updated.

view this post on Zulip Sean (Dec 24 2019 at 07:23):

it was just the one mention

view this post on Zulip Sean (Dec 28 2019 at 06:48):

can anyone tell me why the build of appleseed is giving me errors( i am building it from the source for task 2)

Don't know if you're still trying @Sumagna Das but don't recommend building appleseed from source (but do recommend building brl-cad from source).

view this post on Zulip starseeker (Jan 05 2020 at 15:21):

@Jeffrey Liu I saw you mentioned you sometimes dual-boot to Linux - if you decide to continue with the Appleseed tasks at some point, I'd suggest doing any initial experiments with integrating with BRL-CAD on that platform if you're at all comfortable working there.

I've managed to get a basic "art" executable building there using the binary Appleseed downloadable from their website, as long as you configure BRL-CAD to build with system libpng and libz and have Appleseed where CMake can see it:

cmake .. -DBRLCAD_PNG=SYSTEM -DBRLCAD_ZLIB=SYSTEM

If you start from Windows, you'll have to figure out how to mix appleseed with librt on that platform - that's currently completely untried, so I don't know what you'd be up against. Hopefully, on the Linux side, there'd be a much shorter path to start integrating the work you've done with the "art" executable.

view this post on Zulip starseeker (Jan 05 2020 at 15:22):

(Alternately, if you prefer not to boot to Linux a VirtualBox vm with Ubuntu installed would be another option.)

view this post on Zulip Jeffrey Liu (Jan 05 2020 at 17:14):

Ah ok, thanks for the heads up! I chose to work on Windows because I was having some issues with BRLCAD on Linux at first (if you remember, MGED wasn't exactly working correctly for me). However, it does seem like CMake in general is easier to manage on Linux, so that'll definitely be something I'll try.

view this post on Zulip Jeffrey Liu (Jan 05 2020 at 17:17):

By the way, @Sean I looked at the Appleseed integration task #7 requirements, and since "creating the art application" was part of it, if it's already done, then would the only part of the task be to handle the docbook manual stuff?

view this post on Zulip Jeffrey Liu (Jan 05 2020 at 17:56):

Also, regarding the Linux/Windows situation, I do recall that franz and a couple other developers mentioned the option of perhaps compiling Appleseed with BRLCAD dependencies. This solution would work for both platforms, right?

view this post on Zulip Jeffrey Liu (Jan 05 2020 at 21:57):

Something else the developers recommended was to build Appleseed with static libraries (although they only mentioned Linux, this should work on Windows as well right?)

view this post on Zulip starseeker (Jan 06 2020 at 03:39):

@Jeffrey Liu eventually we'll need to build appleseed using the same support libs BRL-CAD itself is using, but (especially doing it cross platform) that's a rather non-trivial task and definitely a non-trivial amount of work.

view this post on Zulip starseeker (Jan 06 2020 at 03:40):

Static libraries might help, but you'll still have to build appleseed and that in and of itself doesn't look to be trivial (at least, without a very specific compilation environment.)

view this post on Zulip starseeker (Jan 06 2020 at 03:41):

From a utility standpoint, particularly since you have a demonstrated rendering with librt+appleseed, the biggest bang for the buck would be to get a working "art" application up and running, even if it requires a particular set of configuration options and build setup.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 03:42):

Yeah, the integration does seem like quite a challenge. One thing I was wondering, though: say someone were to install BRLCAD as a client - would they be expected to install appleseed as well? Or would it come pre-compiled?

view this post on Zulip starseeker (Jan 06 2020 at 03:43):

If we can get to a working art application, it's worth doing the necessary deep dive to handle the appleseed building problem.

view this post on Zulip starseeker (Jan 06 2020 at 03:43):

without that incentive, we're just getting the cart before the horse

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 03:44):

That makes sense, I'm just worried that the approach I end up taking is ultimately not going to work on another platform.

view this post on Zulip starseeker (Jan 06 2020 at 03:44):

I've got a pending change to how we manage src/other dependency building that should be at least some help as well, but that's waiting on the Git conversion.

view this post on Zulip starseeker (Jan 06 2020 at 03:45):

The art application will be a C++ application linking to the librt and appleseed libraries. As long as that hook-up is correct on one platform, we can build from there.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 03:46):

I think aside from the dependency management, I have a pretty good idea of how the integration might happen, where first the appleseed project would be generated with some converted .g to .obj and then rendered.

view this post on Zulip starseeker (Jan 06 2020 at 03:48):

<nod> however you want to set it up initially is fine - iterating to the "best" state of the code is a given in this type of work.

view this post on Zulip starseeker (Jan 06 2020 at 03:49):

the current "art" executable is just doing the hello world example - my initial thought would be to convince it instead to produce the render that you achieved before you switched to EBM.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 03:51):

Yeah, I think that would be a good starting point. Something that I'm still not quite sure how to do would be to generate (and then maybe update, if rendering is called multiple times) an appleseed project and then render given a single command.

view this post on Zulip starseeker (Jan 06 2020 at 03:53):

hmm. Is there something that you need to do that the existing src/rt/art.cpp code isn't doing?

view this post on Zulip starseeker (Jan 06 2020 at 03:54):

Around line 209 something would change certainly (that's where it's loading the hello world scene.obj file from disk)

view this post on Zulip starseeker (Jan 06 2020 at 03:55):

Presumably you'd need to insert instead whatever objects you created for the BRL-CAD scene objects.

view this post on Zulip starseeker (Jan 06 2020 at 03:56):

and I imagine there will be some other tweaks beyond that obvious one, but my hope was that it might be an incremental sort of thing to adjust the helloworld example to do a librt plugin render instead.

view this post on Zulip Sean (Jan 06 2020 at 03:56):

By the way, Sean I looked at the Appleseed integration task #7 requirements, and since "creating the art application" was part of it, if it's already done, then would the only part of the task be to handle the docbook manual stuff?

It's not done -- starseeker did most of the heavy lifting for the build system pieces, linking against appleseed libs, but much more is needed.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 03:59):

From what I understand, helloworld.cpp is the code to generate an appleseed project, while something else such a sphereobject.cpp is the code to an actual object that defines intersect() and such. I modified sphereobject.cpp so that the intersect() could work off of librt and a geometry file, but I would still need to generate an appleseed project which implements that plugin to actually render.

view this post on Zulip Sean (Jan 06 2020 at 04:02):

task #7 is to make a binary application that respects most of rt's options (in the sense that it parses them) and has some initial documentation. it's a task about taking a step on the CAD side (sans appleseed really). task #8 is what is complete now.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:02):

Although actually, now that I think about it, the plugin I made could just be reused, so it would just be a matter of generating a project that uses the plugin with the correct parameters and then calling appleseed rendering.

view this post on Zulip starseeker (Jan 06 2020 at 04:05):

@Jeffrey Liu Right. If you need help building the plugin as part of the art build let me know.

view this post on Zulip starseeker (Jan 06 2020 at 04:06):

although it sounds like there are some tasks ahead of when you'll get to that one...

view this post on Zulip starseeker (Jan 06 2020 at 04:07):

not to mention finishing up the EBM work - don't let me distract you too much ;-)

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:07):

task #7 is to make a binary application that respects most of rt's options (in the sense that it parses them) and has some initial documentation. it's a task about taking a step on the CAD side (sans appleseed really). task #8 is what is complete now.

Ah I see, sorry about that misunderstanding.

view this post on Zulip Sean (Jan 06 2020 at 04:08):

just one big one. 7 is kinda big.

view this post on Zulip Sean (Jan 06 2020 at 04:08):

8 would have been hard without cmake experience, but you did it for him :)

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:09):

Jeffrey Liu Right. If you need help building the plugin as part of the art build let me know.

Thanks! I think for now, I should be fine just using the dll I built, but going forward, it would be better to include it directly into the source for the user to compile.

view this post on Zulip starseeker (Jan 06 2020 at 04:10):

@Jeffrey Liu OK. Remember though, I've never tried the current art.cpp build on Windows - I have no idea what will happen.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:11):

Oh right, it might be better if I switched to Linux first and then recompiled

view this post on Zulip Sean (Jan 06 2020 at 04:14):

#10 is the open-ended hard one

view this post on Zulip Sean (Jan 06 2020 at 04:15):

#9 might be a little tricky, but I hope not if it's easy enough to call into the plugin like the examples

view this post on Zulip starseeker (Jan 06 2020 at 04:16):

@Sean are we going to have to generate a project and a loadable plugin generally, or will we eventually be able to boil it down to a strictly in-memory process to generate the png file? (I haven't dug deep enough to know...)

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:19):

#10 is the open-ended hard one

Actually, I was a little confused by this one. I thought that with the plugin, since it reads .g directly, there wouldn't be a need to load geometry?

view this post on Zulip starseeker (Jan 06 2020 at 04:23):

@Jeffrey Liu I don't know the details, but I'm presuming that the plugin generates some kind of scene object based on the BRL-CAD geometry information?

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:25):

Well, here's what I initially had: art-plugin.cpp For the most part, it used librt's rt_shootray() to get information directly from the .g but it was still missing a few things, like the UV coordinate at the point of intersection.

view this post on Zulip starseeker (Jan 06 2020 at 04:25):

My first instinct would be to see if the MeshObject used in the art.cpp helloworld code can be replaced with a ProceduralObject

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:26):

That shouldn't be a problem, so long as the dll/so is present.

view this post on Zulip starseeker (Jan 06 2020 at 04:29):

My naive guess is that the key will be in what art.cpp:216 is doing - if we create BrlcadObject objects and insert them, it may even "just work"...

view this post on Zulip starseeker (Jan 06 2020 at 04:30):

Anyway, interesting future problems. I've got to call it a night - later all

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:30):

That's what I was hoping, and although I was manually editing the project to test the plugin, I can't see why generating it instead wouldn't work.

view this post on Zulip Jeffrey Liu (Jan 06 2020 at 04:31):

Thanks so much for your help, good night!

view this post on Zulip Sean (Jan 07 2020 at 07:15):

@Sean are we going to have to generate a project and a loadable plugin generally, or will we eventually be able to boil it down to a strictly in-memory process to generate the png file? (I haven't dug deep enough to know...)

@starseeker I believe it can all be done in memory

view this post on Zulip Sean (Jan 07 2020 at 07:21):

Actually, I was a little confused by this one. I thought that with the plugin, since it reads .g directly, there wouldn't be a need to load geometry?

@Jeffrey Liu it depends how 'art' is set up. conceptually, you were running the plugin within the context of the appleseed renderer that has default notions of a scene, a view, a project, etc.

view this post on Zulip Sean (Jan 07 2020 at 07:21):

NONE of that exists for 'art' until it is implemented, so the assumption is that there is some basic setup that is going to be required before you'll be able to call the plugin.

view this post on Zulip Sean (Jan 07 2020 at 07:23):

it may not be necessary, but I don't see how it'll work without first loading the geometry in art, and then passing or calling into that loaded geometry in the plugin. that may be something as simple as changing when the geometry loading function is called, or something else might be needed, because we do obviously only want to load geometry once if we can.

view this post on Zulip Sean (Jan 07 2020 at 07:26):

or maybe nothing needs to change, but have to keep in mind some of the things rt is doing that will have to be replicated include setting up default view that is based on the geometry. presently, the geometry is loaded and prep'd in rt so it can figure out what size to make the render window, where to create default lights, what rays to shoot, etc.

view this post on Zulip Jeffrey Liu (Jan 07 2020 at 12:50):

Ah right, I think that makes sense. I forgot to consider that everything is being done from "scratch" rather than from something like appleseed studio.

view this post on Zulip Sean (Jan 07 2020 at 22:27):

right, you're basically implementing a command-line version of appleseed studio

view this post on Zulip Sean (Jan 07 2020 at 22:27):

(which might exist)

view this post on Zulip Jeffrey Liu (Jan 08 2020 at 09:53):

I believe that it does - it might be a good starting place to reference.

view this post on Zulip Jeffrey Liu (Jan 10 2020 at 02:26):

By the way, I noticed that starseeker created art.cpp inside of src/rt. Is there any advantage to doing it there rather than create a new src/art? Personally, I was thinking of creating a new directory for organizational purposes.

view this post on Zulip Sean (Jan 10 2020 at 17:11):

By the way, I noticed that starseeker created art.cpp inside of src/rt. Is there any advantage to doing it there rather than create a new src/art? Personally, I was thinking of creating a new directory for organizational purposes.

new directory is just fine. the advantage of src/rt is so you can reuse and call into the existing source files that rt uses for things like option parsing, but there are other tools that "peek" into the rt directory for those files (like "remrt")

view this post on Zulip Jeffrey Liu (Jan 10 2020 at 17:47):

Ah ok thanks, I think I'll continue with a new directory then.

view this post on Zulip Mikki Jhuria (Jan 10 2020 at 18:04):

Hello, Can anyone please tell me how to work on a model and make one I have absolutely no knowledge of how to input the data into MGED.

view this post on Zulip Jeffrey Liu (Jan 10 2020 at 18:28):

new directory is just fine. the advantage of src/rt is so you can reuse and call into the existing source files that rt uses for things like option parsing, but there are other tools that "peek" into the rt directory for those files (like "remrt")

So when you mentioned that the application would need to be able to parse rt's options, would I need to use "remrt" somehow to access those source files that can handle that?

view this post on Zulip Jeffrey Liu (Jan 10 2020 at 18:39):

Oh also about this path on the task page doc/docbook/man1/art.xml, did you mean doc/docbook/system/man1/art.xml?

view this post on Zulip starseeker (Jan 11 2020 at 02:24):

Yes, the path would be doc/docbook/system/man1/art.xml

view this post on Zulip starseeker (Jan 11 2020 at 02:28):

So for option parsing there are a few options... I suppose reusing src/rt/opt.c is probably the simplest.

view this post on Zulip starseeker (Jan 11 2020 at 02:30):

Eventually I'd like to get a bu_opt based parser for those options, but that's probably not a good GCI task.

view this post on Zulip starseeker (Jan 11 2020 at 02:31):

Definitely not, in fact - there'd be some custom logic needed in all likelihood.

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:40):

So when you say reuse src/rt/opt.c, would that involve somehow accessing that file from src/art, or do you mean to just copy the file into src/art/opt.c as well?

view this post on Zulip Sean (Jan 11 2020 at 05:41):

no copying :)

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:41):

Ah, so I guess remrt should be used somehow?

view this post on Zulip Sean (Jan 11 2020 at 05:41):

you just reference it in the CMakeLists.txt file if it needs to be linked against, and you just declare the functions and variables you use from it before using them

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:42):

Oh that makes more sense. If I may ask though, what is remrt and how is it used?

view this post on Zulip Sean (Jan 11 2020 at 05:44):

remrt is a distributed ray tracing framework for rt

view this post on Zulip Sean (Jan 11 2020 at 05:44):

"remote rt" .. it's a ray tracing server

view this post on Zulip Sean (Jan 11 2020 at 05:44):

it lets you run rt across more than one computer so they can all work on the same image

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:45):

Oh that's really cool, I think I've heard about things like that for blender as well - like cloud rendering or something

view this post on Zulip Sean (Jan 11 2020 at 05:46):

whether than's 4 or 10 computers in your home or 100000 nodes

view this post on Zulip Sean (Jan 11 2020 at 05:46):

brl-cad's was actually "the first"

view this post on Zulip Sean (Jan 11 2020 at 05:47):

at least the first to demonstrate real-time rendering via this distributed computation method

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:49):

Oh wow I didn't know that, that's something I might want to look into later, but I guess I won't be using it for src/art

view this post on Zulip Sean (Jan 11 2020 at 05:49):

remrt was used back in the early 80's at a time when rendering used to take several minutes for even simple scenes, remrt+rt was use to render animation around 5 frames per second

view this post on Zulip Sean (Jan 11 2020 at 05:49):

not any time soon, but we'll eventually need to do something for art

view this post on Zulip Sean (Jan 11 2020 at 05:49):

appleseed's rendering method is 100x slower than what rt is doing as it's a much more advanced light simulation

view this post on Zulip Sean (Jan 11 2020 at 05:50):

bidirectional path tracing is a comparatively expensive method, so it will benefit greatly from more cpu cores

view this post on Zulip Sean (Jan 11 2020 at 05:51):

but baby steps. first is working at all. then working multithreaded. then we can think about how to handle distributed.

view this post on Zulip Sean (Jan 11 2020 at 05:51):

CMakeLists.txt:BRLCAD_ADDEXEC(remrt "../rt/opt.c;ihost.c;remrt.c" "liboptical;libfb")

view this post on Zulip Sean (Jan 11 2020 at 05:51):

that's how remrt uses rt's opt.c file

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:52):

Yeah, I think I'm thinking a little too ahead right now. For now, task 7 - is that also what you were looking for when you were talking about the option parsing?

view this post on Zulip Sean (Jan 11 2020 at 05:53):

yes

view this post on Zulip Sean (Jan 11 2020 at 05:53):

the general idea is that the tool will greatly benefit if it can be a drop-in replacement for rt

view this post on Zulip Sean (Jan 11 2020 at 05:54):

that means it needs to handle some of rt's options like -a -e for azimuth and elevation (e.g., rt -a 35 -e 10 ...) or -s for size (e.g., rt -s1024)

view this post on Zulip Sean (Jan 11 2020 at 05:54):

it's really just a handful, not necessarily all of them, but some of them like -M are rather complicated

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:54):

Ah ok, thanks! I think I need to research/learn a lot more about CMake if I want to do all these things that we've talked about for appleseed - right now all the macros are really confusing so it takes me a while to kinda understand what's actually going on, but I guess some of that also comes with experience

view this post on Zulip Sean (Jan 11 2020 at 05:55):

we ideally want it to set up essentially the same view, but just render a much more visually interesting image

view this post on Zulip Sean (Jan 11 2020 at 05:55):

or just ask

view this post on Zulip Sean (Jan 11 2020 at 05:55):

or just do whatever you need to do and one of the other devs can clean it up after you get it working

view this post on Zulip Sean (Jan 11 2020 at 05:56):

that's why most of the tasks don't even mention the build system at all

view this post on Zulip Sean (Jan 11 2020 at 05:56):

it can quickly turn into a major distraction. it's more important that you demonstrate the capability bits first.

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 05:57):

Yep, starseeker has already helped me a ton for both ebm and appleseed. I don't want to bother the devs too much though, especially with simple questions that can be googled.

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:03):

I'm still not really sure how to proceed with the Appleseed linkage though - I think the easiest way, manually speaking, would be to just include the appleseed dll built with static libraries, but this probably isn't ideal in the long run?

view this post on Zulip Sean (Jan 11 2020 at 06:03):

not a bother, ask away -- we want to help

view this post on Zulip Sean (Jan 11 2020 at 06:04):

that's what open source is all about. helping each other, working together.

view this post on Zulip Sean (Jan 11 2020 at 06:06):

I'm still not really sure how to proceed with the Appleseed linkage though - I think the easiest way, manually speaking, would be to just include the appleseed dll built with static libraries, but this probably isn't ideal in the long run?

Did what starseeker stub in not work for you?

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:09):

Uh, I'm still on Windows because I was having some trouble with Linux, so I don't think the CMake logic would work.

view this post on Zulip Sean (Jan 11 2020 at 06:09):

why wouldn't it?

view this post on Zulip Sean (Jan 11 2020 at 06:10):

it's simply relying on FindPackage(Appleseed) to work, which is to say that it wants you to have installed appleseed first and if it can detect it, variables get set where the libraries were found, and it should work.

view this post on Zulip Sean (Jan 11 2020 at 06:11):

if anything, there will be variables you can set manually in cmake to make it work. we can walk you through that bit but the first thing is to simply try it and report back.

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:12):

I'm not too sure, but I also did just svn update and then reconfigure cmake yesterday, and it said appleseed wasn't found even though I had it installed.

view this post on Zulip Sean (Jan 11 2020 at 06:13):

well that's actually good in a way, because you didn't tell it where to find appleseed

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:19):

Oh, is there something that I would need to set somewhere? I thought find_package just found things like that automatically if there existed a CMake text there

view this post on Zulip Sean (Jan 11 2020 at 06:19):

Two things I would check are 1) what the Cmake build output and error logs say when it tried to find appleseed and 2) what cmake variables there are that can be set (dump the list on the ccmake advanced options listing is one way).

view this post on Zulip Sean (Jan 11 2020 at 06:21):

find_package finds things automatically that are installed in system locations, which on windows is essentially nothing because most apps don't install into system locations. They go into program files or elsewhere, so you have to tell cmake where to look.

view this post on Zulip Sean (Jan 11 2020 at 06:21):

still first step would be to check the log, see what it tried to do

view this post on Zulip Sean (Jan 11 2020 at 06:21):

can you post them here?

view this post on Zulip Sean (Jan 11 2020 at 06:23):

looking at how the maya plugin is compiled on windows tells me it can work: https://github.com/appleseedhq/appleseed-maya/blob/master/CMakeLists.txt

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:27):

Is this what you were referring to? CMakeOutput.log It looks like the only mention of appleseed is STATUS: Could NOT find APPLESEED (missing: APPLESEED_LIBRARY)

view this post on Zulip Sean (Jan 11 2020 at 06:28):

what about CMakeError.log

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:29):

Oh right, I didn't check that. Here it is: CMakeError.log

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:29):

Doesn't seem like there's any mention of appleseed though

view this post on Zulip Sean (Jan 11 2020 at 06:31):

Huh, that is peculiar

view this post on Zulip Sean (Jan 11 2020 at 06:35):

regardless, so the next would be the cmake vars that override

view this post on Zulip Sean (Jan 11 2020 at 06:35):

try setting the cmake variable Appleseed_ROOT to where appleseed is installed

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 06:37):

So that would just be something like set(Appleseed_ROOT "path/to/appleseed") right before the rest of the logic right?

view this post on Zulip Sean (Jan 11 2020 at 07:02):

er, the typical way would be wherever you run cmake

view this post on Zulip Sean (Jan 11 2020 at 07:02):

are you using the GUI or command line

view this post on Zulip Sean (Jan 11 2020 at 07:03):

in the gui, it'll be something like this: https://stackoverflow.com/questions/46268235/cmake-gui-resets-parameter-how-do-i-set-parameter-in-cmake-gui

view this post on Zulip Sean (Jan 11 2020 at 07:03):

on the command line, it's cmake -DAppleseed_ROOT="path/to/appleseed" ...

view this post on Zulip Mikki Jhuria (Jan 11 2020 at 07:08):

BRL-CAD main repository has between a: 0-7000, b: 7001-70000, or c: 70001-100000 commits can somebody help me with this I can figure it out from BRLs github page...Please

view this post on Zulip Mikki Jhuria (Jan 11 2020 at 07:24):

Just submitted my first task .... https://codein.withgoogle.com/dashboard/task-instances/5434072998871040/ !

view this post on Zulip Mikki Jhuria (Jan 11 2020 at 07:25):

Can a mentor please review my task ...?

view this post on Zulip starseeker (Jan 11 2020 at 13:21):

Note I have no idea how libz and libpng will play out on Windows with the art.cpp build... on Linux I had to use system libs, our bundled ones didn't work. Building with "system libs" on Windows is theoretically possible, but I've never done it personally - no idea if it works.

view this post on Zulip starseeker (Jan 11 2020 at 13:22):

On linux the CMake line I used (after installing the libpng and libz development packages) was:

cmake .. -DAPPLESEED_ROOT=/path/to/appleseed -DBRLCAD_PNG=SYSTEM -DBRLCAD_ZLIB=SYSTEM

view this post on Zulip starseeker (Jan 11 2020 at 13:50):

@Jeffrey Liu The art binary is a really mean way to get introduced to our CMake build - it's one of the more challenging scenarios (3rd party binary being linked in on Windows) and it's also an area where there are pending changes to how we're going to manage the process anyway.

Any way you can get art building is fine for these purposes - once it is demonstrated to work, we'll begin the process of setting up Appleseed as a proper src/other BRL-CAD dependency. (That'll be epic, but worth it if we can leverage them for high quality rendering...)

In the longer term, if you really want to do a deep dive in to our CMake, some particulars of our build system are documented in the following report (somewhat dated now, but still should have some useful content):
https://www.arl.army.mil/arlreports/2013/ARL-TR-6475.pdf

For writing CMake, there are a number of resources online - this looks like it might be a decent starting point, although I've not been through it in detail:
https://cliutils.gitlab.io/modern-cmake/

Note that our CMake is a bit conservative by modern standards - there are a number of features we really should be making better use of that I've never had time to retrofit. Also, we are very ambitious in a couple ways which so far as I know are still unique in CMake land - in particular our 3rd part build management, automatic handling of multi-config building, and maintaining a complete list in CMake of all files significant to the build.

We also micromanage our build flags, specifically enabling a wide variety of warnings. We have a DocBook compilation setup used to produce html, man and (optionally) PDF versions of our documentation as part of the build, some custom logic for Tcl/Tk related requirements, and (although we haven't turned it on yet) an option to use astyle to enforce style conventions at build time.

The upshot is our logic won't look very much like "vanilla" CMake, although there are usually analogies - BRLCAD_ADDEXEC, for example, is our wrapper around add_executable and BRLCAD_ADDLIB wraps add_library.

That's why I went ahead and set up src/rt/CMakeLists.txt to build art.cpp - hopefully, that should make it more straightforward to get the basic setup going.

view this post on Zulip starseeker (Jan 11 2020 at 13:54):

@Jeffrey Liu Tell you what - I'll go ahead and shift the art.cpp file to src/art and get it set up, since I have a machine where I can test it - I almost did that anyway, but got lazy ;-)

view this post on Zulip starseeker (Jan 11 2020 at 14:29):

@Jeffrey Liu OK, moved - the build part of the opt.c is there as well, but the actual use of it in the logic is still up to you. You'll need to re-run CMake, since the build logic is changed to reflect the moved files.

I'd suggest trying to get art -h to print a help message as a good first goal.

view this post on Zulip Mikki Jhuria (Jan 11 2020 at 14:36):

Can somebody please tell me how to use the tops in MGED database?
Thank You

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 16:37):

Thanks so much for your help @starseeker! Although, in the future, you could just let me know what to do and I could do it myself :) I don't want to just have other devs be doing the work!

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 16:38):

As for the conflicting dependencies, many of the Appleseed devs have recommended building the appleseed shared library using static libraries. Would that help that issue?

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 16:43):

Thank you for pointing me to those CMake resources as well by the way, I'll be sure to read through those. I was trying to just use CMake.org but I wasn't getting a good overall grasp.

view this post on Zulip starseeker (Jan 11 2020 at 16:58):

@Jeffrey Liu In this instance I'm just trying to clear away the underbrush so you can focus your efforts on the core functionality. Like Sean said earlier, build system issues can be quite a distraction. You'll notice I didn't actually hook up any option handling at all in the code ;-)

view this post on Zulip starseeker (Jan 11 2020 at 16:59):

I'm not 100% sure if the static lib bit would work or not - we'd have to try it and see. You may end up having to do that on Windows - don't know for sure.

view this post on Zulip starseeker (Jan 11 2020 at 17:07):

@Jeffrey Liu What were the issues you were having on Linux, btw?

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 17:08):

Still kinda like November, mged was being weird (took a really long time to open)

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 17:09):

It just seemed a little easier to work/test on Windows

view this post on Zulip starseeker (Jan 11 2020 at 17:09):

On first run, or on all runs? I've had MGED be slow to load the first timeout of the gate as well...

view this post on Zulip starseeker (Jan 11 2020 at 17:10):

Another possibility might be to disable OPENGL adn see if the X display manager works better - our use of OpenGL is quite... quirky by modern standards.

view this post on Zulip Sean (Jan 11 2020 at 17:11):

There is some issue there that I've not been able to figure out. It seems to happen cross-platform to varying degrees where there is a 10-100 second delay the first time it's run. I've not been able to catch it in the act yet to figure out where the time is actually being spent.

view this post on Zulip Sean (Jan 11 2020 at 17:12):

When it first happened, I attributed it to prebinding, but that doesn't explain it happening on Windows.

view this post on Zulip starseeker (Jan 11 2020 at 17:13):

Hmm. Someone's seen it on Windows?

view this post on Zulip Sean (Jan 11 2020 at 17:13):

he's on Windows

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 17:13):

This was happening on Debian - if I recall correctly, doing mged -c and choosing the X display manager did help a little

view this post on Zulip Sean (Jan 11 2020 at 17:14):

ah, okay. yeah on linux it could totally still be prebinding

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 17:15):

That and the fact that I'm just a little more comfortable with MSVS is why I chose to stay on Windows, so hopefully I can still work out the appleseed dependency stuff

view this post on Zulip starseeker (Jan 11 2020 at 17:15):

@Jeffrey Liu If it happens two times in succession it might be worth slapping a profiler like perf on it to see if we can figure out what's going on for sure. (At some point down the road - by all means if you're more comfortable with MSVC stay there for now.)

view this post on Zulip Sean (Jan 11 2020 at 17:16):

compiling everything static should avoid a host of issues, but I wouldn't try that until you run into a problem.

view this post on Zulip Sean (Jan 11 2020 at 17:17):

static libs are going to mean the linker does't have to resolve symbols when the appleseed libs are loaded. if the appleseed libs themselves are static, there shouldn't be any conflict with our versions.

view this post on Zulip Sean (Jan 11 2020 at 17:18):

not great long term, but perfectly fine for this now

view this post on Zulip starseeker (Jan 11 2020 at 17:18):

Unless the Appleseed project has a static download available that would mean an all-up build of Appleseed's sources (and possibly dependencies)...

view this post on Zulip starseeker (Jan 11 2020 at 17:18):

Which might actually be easier on Windows, in some ways, if it does come to that

view this post on Zulip Sean (Jan 11 2020 at 17:20):

@starseeker FYI, I think we should rename our libz and libpng libraries. I believe both libraries have a prefix option we can specify when we build them. If we do that, it should avoid this issue, fix the issue on mac, fix the issue we've had with things like freetype, etc.

view this post on Zulip Jeffrey Liu (Jan 11 2020 at 17:20):

Well the big folder of windows deps that Appleseed provides also has the static option, so it may be an option

view this post on Zulip Sean (Jan 11 2020 at 17:21):

I was noticing that, why I mention it. I think static is necessary for some of appleseeds bigger commercial customers like Maya

view this post on Zulip starseeker (Jan 11 2020 at 17:22):

Ah, that's good news. @Jeffrey Liu Here's your chance to tangle with CMake after all then, if you're so inclined - you'll need to point the art build logic (either the FindApplseed.cmake search or hard-coding in the src/art/CMakeLists.txt file) to those versions and figure out how to get them linked in.

view this post on Zulip starseeker (Jan 11 2020 at 17:23):

@Sean That'll complicate switching between SYSTEM and BUNDLED versions... or where you thinking to have our own logic always use the prefixed versions and never rely on the system?

view this post on Zulip starseeker (Jan 11 2020 at 17:24):

@Jeffrey Liu I'm not actually sure how to build with MSVC using static 3rd party libs, so I'm afraid I can't be too much help for this part - Sean probably knows more than I do though...

view this post on Zulip Sean (Jan 11 2020 at 17:29):

Sean That'll complicate switching between SYSTEM and BUNDLED versions... or where you thinking to have our own logic always use the prefixed versions and never rely on the system?

@starseeker from my understanding, the way their prefixing system works, we'd add a define during compilation (or not) depending on whether we're using ours (or system). that toggles the magic in headers so the right symbols are declared/used, and then the resulting binary only works with one or the other, not both. doesn't require code to change.

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 17:29):

Hey, I was working on task 7 (for now, I'm just trying to get some other stuff besides the appleseed libraries themselves figured out), and I realized that for rt, there is a main.c which calls usage(), which then calls default_options() that sets most of the options. Would this also be recommended for art?

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 17:51):

Also, there is do.c, which is where the rt_cmdtab[] is declared for opt.c. I haven't looked through all of it yet, but would it be safe to just include it in the executable, or are there functions that are specific to rt/rtuif?

view this post on Zulip starseeker (Jan 12 2020 at 20:03):

For art, we want to do (for the moment) what remrt did and just declare a null command table. (If I remember correctly I tossed such a table into art.cpp during build testing.)

The table as implemented by rt ropes in a lot of other rt functions, and it's not clear how many of those are going to translate. I think we'll eventually want some of them, but a lot will depend on the details of what's needed to get appleseed running.

view this post on Zulip starseeker (Jan 12 2020 at 20:04):

I believe calling usage() and having the default_options() set is the correct initial approach.

view this post on Zulip starseeker (Jan 12 2020 at 20:11):

the "rt_do_cmd" function lives down in librt, and we should probably either move a lot of the "standard" commands down there as well or split that whole command API off into it's own module in some shape or form. Sean may have more specific ideas about what to do refactoring wise...

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 20:16):

Ah ok, thanks for the clarification! I found the null command table, but I was asking because I was still getting an error upon compilation (something like extern command_table rt_cmdtab[] unresolved). Could it still be happening because they're in different directories?

view this post on Zulip starseeker (Jan 12 2020 at 20:17):

Um. You're building the art.cpp file? or a different test program?

view this post on Zulip starseeker (Jan 12 2020 at 20:19):

Oh... you might need to try encapsulating the rt_cmdtab struct definition in "extern "C" {" since art is a C++ file.

view this post on Zulip starseeker (Jan 12 2020 at 20:20):

That sort of stuff regularly drives me nuts with MSVC...

view this post on Zulip starseeker (Jan 12 2020 at 20:21):

GCC/clang seem to be somewhat more forgiving, on average - usually it's forgetting to export/import something correctly, but MSVC will somtimes complain about different aspects of the C++ code too.

view this post on Zulip starseeker (Jan 12 2020 at 20:22):

@Jeffrey Liu If you want to try an experiment, you might rename main.c to main.cpp in the main rt application and see what blows up...

view this post on Zulip starseeker (Jan 12 2020 at 20:24):

We mix C and C++ code in a number of places (brep.h is especially bad in that regard, IIRC) and there are various gotchas that need to be observed when doing so. I usually learn about them the way bugs learn about windshields.

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 20:26):

Haha sure I'll try that - although wouldn't it be easier to do the "extern 'C" {" stuff in art.cpp?

view this post on Zulip starseeker (Jan 12 2020 at 20:31):

Yeah, that's what I meant - the rt_cmdtab definition in art.cpp may need to be wrapped

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 20:33):

Oh sorry, I think I misunderstood, I thought you were suggesting main.c to main.cpp as a fix to the previous problem rather than an experiment. I might try it anyways just to see how it goes though :)

view this post on Zulip starseeker (Jan 12 2020 at 20:34):

Ah. No, my apologies. I was suggesting the main.cpp thing as a way to do an independent experiment of how the rt logic will behave when C++ is tossed into the mix.

view this post on Zulip starseeker (Jan 12 2020 at 20:34):

Since rt itself already builds and works, just changing the one file from C to C++ is one way to find out what the issues involved in such a switch are.

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 20:38):

Ah ok that makes sense. Thank you for the insight! I haven't really worked with mixing C and C++, so I didn't even know what extern "C" meant before.

view this post on Zulip starseeker (Jan 12 2020 at 20:40):

https://stackoverflow.com/questions/1041866/what-is-the-effect-of-extern-c-in-c

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 20:51):

So back to the part about do.c and such, would you recommend creating some other files (mimicking do.c, having a main.c to initialize things, etc)?

view this post on Zulip starseeker (Jan 12 2020 at 20:56):

Not unless you have to - I'd just try to get usage to print the help, to start with.

view this post on Zulip starseeker (Jan 12 2020 at 20:56):

What's the Task 7 scope? Are you supposed to demonstrate that the options work?

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 20:59):

I think the main point of the task is just to introduce option parsing (so yeah, probably demonstrating that the options work), and also introducing some initial documentation.

view this post on Zulip starseeker (Jan 12 2020 at 21:01):

Actually, to demonstrate that options parsing works all you would need to do is print out the values assigned to the various options.

view this post on Zulip starseeker (Jan 12 2020 at 21:02):

Check with Sean, but usually GCI task scoping isn't too extreme - I'd say try to get the option parser reading in options, and then just print to stdout what option values are should do for a start.

view this post on Zulip starseeker (Jan 12 2020 at 21:02):

Getting them to work-work requires a working renderer, after all...

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 21:04):

Yeah that makes sense - to demonstrate it, I was hoping to get art -h working so that it could print the other defaults along with it. Is that along the lines of what you meant?

view this post on Zulip starseeker (Jan 12 2020 at 21:22):

Yep

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 23:12):

Alright, I got it to work by calling get_args() and usage() through art. Thanks so much for your help!

view this post on Zulip Jeffrey Liu (Jan 12 2020 at 23:12):

The next part will be tricky though, since that's when I actually need to worry about the appleseed libraries and such.

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 06:44):

@Sean for task #8, could I try to compile BRLCAD using appleseed's versions of libpng and zlib (that would solve the conflicting dependencies, right)? Unless there's another method you'd like for me to try first?

view this post on Zulip Sean (Jan 14 2020 at 07:41):

Sean for task #8, could I try to compile BRLCAD using appleseed's versions of libpng and zlib (that would solve the conflicting dependencies, right)? Unless there's another method you'd like for me to try first?

any means you can get it to work is fine for now @Jeffrey Liu :)

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 07:43):

Oh also @starseeker, for some reason this code didn't find Boost

get_filename_component(APPLESEED_LIB_DIR "${APPLESEED_LIBRARY}" DIRECTORY)
file(GLOB APPLESEED_BOOST_SYSTEM_LIB "${APPLESEED_LIB_DIR}/libboost_system-*")
file(GLOB APPLESEED_OPENIMAGEIO_LIB "${APPLESEED_LIB_DIR}/libOpenImageIO.*")

and I checked out the install appleseed/lib directory but the only libs there were appleseed.lib and appleseed.shared.lib - I guess that means our installs on Windows/Linux were slightly different? I was thinking about using find_package(Boost) and find_package(OpenImageIO) instead but I'm not exactly sure how the FindBoost.cmake and FindOpenImageIO.cmake work exactly.

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 07:47):

Hopefully once I get Boost and OpenImageIO linked in, then compiling BRLCAD using appleseed's versions of libpng and zlib will work :)

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 08:01):

So yeah, just using find_package() on its own isn't working (even though I've located FindBoost.cmake and FindOpenImageIO.cmake in two different directories), so I'm wondering how I'd be able to locate the two. I do think that the original logic is better though, so I'm gonna try to figure what the issue there was.

view this post on Zulip starseeker (Jan 14 2020 at 12:41):

@Jeffrey Liu You're into parts where I don' t know the answers now ;-). On Linux I needed the boost and openimageio libs explicitly listed, but it may very well be that Windows won't even need that.

view this post on Zulip starseeker (Jan 14 2020 at 12:44):

The boost and imageio thing was basically a quick and dirty hack to get it building - a "correct" solution is going to involve properly src/other managing both of those setups (Boost in particular is going to be fun... we tried that once years ago.)

I'd try just not listing them at all and see if pointing to just Appleseed works on Windows.

view this post on Zulip starseeker (Jan 14 2020 at 12:44):

If not, the next step is to just manually force the necessary variables to specific paths.

view this post on Zulip starseeker (Jan 14 2020 at 12:45):

(I.e. short circuit the search logic)

view this post on Zulip starseeker (Jan 14 2020 at 12:48):

Since I've not built against 3rd party Windows libs much, I don't really know how find_package works with .dll vs .lib files and keeping track of all that...

view this post on Zulip starseeker (Jan 14 2020 at 12:48):

I'm sure it's workable (done all the time) but I just don't know the specifics.

view this post on Zulip starseeker (Jan 14 2020 at 12:49):

The other thing I can suggest if you're having more trouble is to make a small stand-alone CMake project and just experiment with that (to avoid needing to re-run BRL-CAD's who configure cycle each time you make a change.

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 16:27):

Ah ok, thanks for the advice! I've been trying to configure my own smaller CMake projects to see how linking goes. I think it is necessary to list them because I was getting a Boost linkage error during compilation, so I guess I'll try forcing the variables for now.

view this post on Zulip Sean (Jan 14 2020 at 16:29):

@Jeffrey Liu you're also perfectly welcome to edit the generated MSVC files directly to add/list the necessary libraries if you're familiar with how to do it. That may be your fastest path forward if you hit a snag with cmake detection. Totally hacked is quite alright.

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 17:20):

Ah ok, thank you for the advice! I wasn't sure if I could do that because task 8 seems to want it done through CMake. That said, I got find_package() to work for Boost after setting -DBoost_ROOT through my smaller tests, so I'll try to see if it works on CMake as well.

view this post on Zulip Sean (Jan 14 2020 at 17:33):

@Jeffrey Liu at this level, all tasks are subject to negotiation and discussion ;) task 8 was primarily completed by starseeker, so the objective is more learning/exploration for you to try and get it working. the more you do, the easier it will be for you and us down the road, but the priority is very much on tasks 9+....

view this post on Zulip Jeffrey Liu (Jan 14 2020 at 22:59):

Hm yeah that does make sense, I guess I shouldn't get too distracted with the configuration details for now.

view this post on Zulip Jeffrey Liu (Jan 15 2020 at 01:24):

YIkes, I'm running into quite a difficult dilemma... so basically, when I try to link "common.h" with boost and appleseed, I'm getting this compilation issue Output-Build.txt which is being caused by these lines:

APPLESEED_DLLSYMBOL void sleep(const std::uint32_t ms);
APPLESEED_DLLSYMBOL void sleep(const std::uint32_t ms, IAbortSwitch& abort_switch);

where the macro APPLESEED_DLLSYMBOL is defined as __declspec(dllimport). The issue is that config_win.h also has this macro:

#define sleep(_SECONDS) (Sleep(1000 * (_SECONDS)))

so there's an error because the compiler thinks that I'm trying to redefine a function that's expecting a definition from a dll.

view this post on Zulip Jeffrey Liu (Jan 15 2020 at 01:28):

I temporarily renamed the config_win.h macro to sleep2, and then everything worked fine. However, that's obviously not going to fly as an actual solution, but I don't think I can just easily rename the appleseed function either. To be honest, I have no idea how to deal with this. Could I get some help in regards to how I could make a compromise between the two?

view this post on Zulip Jeffrey Liu (Jan 15 2020 at 01:35):

But aside from that (after I temporarily renamed the macro to sleep2), I think I finally got art.exe running the helloworld example on Windows :) test.png

view this post on Zulip starseeker (Jan 15 2020 at 04:06):

Woo hoo!

view this post on Zulip starseeker (Jan 15 2020 at 04:08):

@Sean Is there some def/undef trickery that we should try for the sleep bit?

view this post on Zulip starseeker (Jan 15 2020 at 04:18):

@Jeffrey Liu Don't let the sleep bit worry you too much if you have a workaround - I'd definitely try to get your BRL-CAD rendering to generate from that setup now :-)

view this post on Zulip Sean (Jan 15 2020 at 06:02):

@Jeffrey Liu if you make sure common.h is first, just add "#undef sleep" before your #include's for appleseed.

view this post on Zulip Sean (Jan 15 2020 at 06:03):

that is awesome progress!

view this post on Zulip Jeffrey Liu (Jan 15 2020 at 06:03):

Oh right, I didn't even think about that. Thank you!

view this post on Zulip Sean (Jan 15 2020 at 06:04):

what geometry is that?

view this post on Zulip Sean (Jan 15 2020 at 06:04):

doesn't look like brl-cad geometry if I had to guess -- is it manually created in art ?

view this post on Zulip Jeffrey Liu (Jan 15 2020 at 06:04):

So since art.cpp is just the helloworld example at the moment, it's using the scene.obj provided from the appleseed source.

view this post on Zulip Jeffrey Liu (Jan 15 2020 at 06:06):

The #undef sleep worked :)

view this post on Zulip Sean (Jan 15 2020 at 06:08):

great

view this post on Zulip Sean (Jan 15 2020 at 06:08):

put a comment so it's documented as to why that's there

view this post on Zulip Jeffrey Liu (Jan 16 2020 at 18:44):

This might be thinking a little too far ahead (and also just pure speculation), but for appleseed option parsing, I was wondering if it could just work if, for example, after processing options (like -w), I just referenced those variables from opt.c. So like if -w was set, I would just reuse width when creating the appleseed project and calling .insert("resolution", "640 480"). Would there be an issue with that?

view this post on Zulip Jeffrey Liu (Jan 16 2020 at 18:45):

Also, in the future, if there are any default command line options that only apply to rt but not art, would it help to define some APPLESEED macro and then checking whether it's defined or not when the defaults are set in usage.cpp?

view this post on Zulip Jeffrey Liu (Jan 16 2020 at 23:37):

Oh also @Sean , I was taking a look at the appleseed command-line version and I saw that task 10 was about "loading brlcad geometry", but I was wondering if it would be possible to just set up rt (configuring ap and rtip correctly), and then raytrace using rt to detect brlcad geometry? My assumption is that with rt set up correctly, then brlcad raytracing will get all of the raytracing information necessary (intersect, etc), and then just pass it down to appleseed for the shading calculations.

view this post on Zulip Jeffrey Liu (Jan 16 2020 at 23:38):

Kind of like originally with the plugin, where all of the raytracing was getting done through rt. The only difference being that in this case, art would also be the one building the appleseed scene.

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 04:30):

Ok, so I tried to follow through on what I was trying to say, and I think I got it working up to the point where the project is generating successfully. Rendering still isn't working though, and I think it has to do with the same multi-threading issue as before.

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 06:18):

So after a lot of manual set up (configuring library directories, etc), one run of art.exe has finally produced an image: test.png

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 06:18):

Using havoc.g as the input

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 06:19):

I think if I can set up the camera settings and such to respect rt, then it'll start looking even more "correct"

view this post on Zulip starseeker (Jan 17 2020 at 12:33):

Woo hoo!

view this post on Zulip Sean (Jan 17 2020 at 14:04):

@Jeffrey Liu that's like the best teaser you could have accidentally stumbled across

view this post on Zulip Sean (Jan 17 2020 at 14:07):

This might be thinking a little too far ahead (and also just pure speculation), but for appleseed option parsing, I was wondering if it could just work if, for example, after processing options (like -w), I just referenced those variables from opt.c. So like if -w was set, I would just reuse width when creating the appleseed project and calling .insert("resolution", "640 480"). Would there be an issue with that?

Honestly, that's probably what I'd think to do too. Don't know if it's an issue. Really most of the option parsing can just be thought of as simply setting some global variable so you can get at the value later, even for things like -a -e or -A or -C etc

view this post on Zulip Sean (Jan 17 2020 at 14:08):

The goal is going to be compatibility with what the user is seeing in MGED, so it's likely going to end up being very similar to what RT does, which is why the other task just suggested calling into rt's opt.c so it's global vars are set and accessible.

view this post on Zulip Sean (Jan 17 2020 at 14:25):

Also, in the future, if there are any default command line options that only apply to rt but not art, would it help to define some APPLESEED macro and then checking whether it's defined or not when the defaults are set in usage.cpp?

I don't think it's necessary. Unsupported options can be disabled (see src/rt/viewcheck.c:application_init() for an example). If it diverges really far (it shouldn't, that's part of the point), then we can refactor/change the default options, move some to a general set that all use, others that are rt-specific to a different set, etc. Don't want to compile-time conditionalize if we can because that's harder to maintain and debug.

view this post on Zulip Sean (Jan 17 2020 at 14:27):

Oh also Sean , I was taking a look at the appleseed command-line version and I saw that task 10 was about "loading brlcad geometry", but I was wondering if it would be possible to just set up rt (configuring ap and rtip correctly), and then raytrace using rt to detect brlcad geometry? My assumption is that with rt set up correctly, then brlcad raytracing will get all of the raytracing information necessary (intersect, etc), and then just pass it down to appleseed for the shading calculations.

shading calculations often involves shooting more rays (down in the shading calculations), so the plugin still comes into play. But sure, it's entirely possible to either let appleseed set up the primary rays, or you set up the primary rays and let appleseed handle the secondary. both should be doable.

view this post on Zulip Sean (Jan 17 2020 at 14:28):

I think if I can set up the camera settings and such to respect rt, then it'll start looking even more "correct"

@Jeffrey Liu do you know if appleseed has support for orthographic views or just perspective views?

view this post on Zulip Sean (Jan 17 2020 at 14:29):

if it doesn't, that'd be a good reason for making art shoot the main rays and only letting appleseed handle secondary rays.

view this post on Zulip Sean (Jan 17 2020 at 14:30):

would just need to check if there's any other magic going on like image post-processing for depth of field or other effects that can happen after primary rays are fired.

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 15:07):

Jeffrey Liu do you know if appleseed has support for orthographic views or just perspective views?

I'm not sure yet, but I would assume that it does - I'll try to look around or ask franz for more info about that. Could I ask what you mean by letting art handle the primary rays with appleseed handling the secondary rays?

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 15:08):

I know that the plugin has 2 different intersect() functions, one for a detailed result with another for just a hit/miss, but I'm not sure how I'd be able to separate that so art could handle it.

view this post on Zulip Sean (Jan 17 2020 at 16:19):

@Jeffrey Liu in ray tracing, the very first rays that get shot from the camera are called "primary rays". these rays are the primary basis for the image that is generated.

view this post on Zulip Sean (Jan 17 2020 at 16:21):

those primary rays hit objects in the scene and cause other rays to be fired, for example to see how much light , or the ray is reflected, refracted, scattered, etc. Those are called "secondary rays".

view this post on Zulip Sean (Jan 17 2020 at 16:23):

The handling of both primary and secondary rays are typically quite different in most rendering systems, even though both involve the same intersection testing (e.g., rt_shootray()).

view this post on Zulip Sean (Jan 17 2020 at 16:23):

considering appleseed has this: https://github.com/appleseedhq/appleseed/issues/2218 it's a pretty safe bet they have an ortho camera :)

view this post on Zulip Sean (Jan 17 2020 at 16:26):

speaking of which, the cornellbox example is a nice demo of how to programmatically set up the scene with colors and materials: https://github.com/appleseedhq/appleseed/blob/8a9fa1c264f8a993a74c256700847cc5fc90392b/src/appleseed/renderer/modeling/project-builtin/cornellboxproject.cpp

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 23:34):

Ah, I think that makes sense - so I guess there are multiple secondary rays shot for each primary ray hit?

view this post on Zulip Jeffrey Liu (Jan 17 2020 at 23:37):

considering appleseed has this: https://github.com/appleseedhq/appleseed/issues/2218 it's a pretty safe bet they have an ortho camera :)

Yep, franz responded and he told me that it's just a matter of configuring a pinhole vs orthographic camera. I hadn't found the cornell box example yet though, so thank you for that :)

view this post on Zulip Jeffrey Liu (Jan 18 2020 at 00:22):

Oh by the way, what did you mean about double prepping the geometry in art and then in the plugin? I thought that it was only being prepped in the plugin (the only argument passed to it is the name of the database), so am I neglecting to account for something?

view this post on Zulip Jeffrey Liu (Jan 18 2020 at 06:54):

Hm, does opt.c not actually store the .g file name? I'm trying to use it in art.cpp to pass as a parameter, but it looks like opt.c just uses the bu_optarg to store it temporarily.

view this post on Zulip Jeffrey Liu (Jan 18 2020 at 07:07):

Oh I think I kinda know what you meant by prepping in both art and the plugin... because the rt camera and stuff is set up during rt prep, but I will need those configurations for art, and the issue is rt prep is currently happening in the plugin?

view this post on Zulip Jeffrey Liu (Jan 19 2020 at 03:26):

Hm, ok I think I got the title file working, but the objects themselves will probably be the larger challenge. I don't think I can just pass the array pointer because franz said passing pointers is quite unsafe... it's probably easier to just concatenate the object names together with spaces in between and then parse again in the plugin, but I'm wondering if there's any better way to get the arguments.

view this post on Zulip Jeffrey Liu (Jan 19 2020 at 07:59):

Yep, so passing the arguments works. Here's the rendered image when I call art -o havoc.png havoc.g s.tail40 s.tail41 s.tail42: havoc.png It's not the best way for sure, but once I can get passing pointers and stuff figured out, I think a lot of things would get easier/smoother.

view this post on Zulip Jeffrey Liu (Jan 19 2020 at 08:03):

Or actually, I just realized - if I can pass ap and rtip directly into the BrlcadObjectFactory create() function, things might get a whole lot simpler. I'll have to ask franz more about it though.

view this post on Zulip Jeffrey Liu (Jan 19 2020 at 16:19):

Update to that: franz said that it should be possible, so I'll have to refactor a lot of my code for the next task. One thing I am curious about, though, is how I'll be able to access the camera settings. It would be great if it was just something I could access through rtip or something, but I'll have to look more into it.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 01:48):

Okay, so I was able to refactor so that now the plugin only takes in a pointer for the application and a pointer for the resources. It's still a little messy of course, but it's made some other things (namely the object array) a lot simpler. Next step is probably to configure the camera and such, but I'm having some trouble figuring out how I might be able to access stuff like the rt camera settings.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 01:53):

Passing the things as pointers has its benefits and drawbacks, though: since it no longer needs the BrlcadObjectFactory anymore, there should technically be some way to integrate the plugin into the executable without needing an external shared library. However, this also means that if the *.appleseed project was ever going to be created for debugging purposes, appleseed applications would not be able to directly render it.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 02:05):

I also noticed that I've been getting a lot of messages like this:

OVERLAP1: /s.tail41
OVERLAP2: /s.tail42
OVERLAPa: dist=(0, 915.813) isol=s.tail41 osol=s.tail41
OVERLAPb: depth 915.81326mm at (4385.66, 236.886, 1083.62) x0 y0 lvl0
(overlaps omitted)

but I'm not really sure how to interpret them exactly. Are they warnings/issues? They don't appear when I render the same objects with rt, which is why I'm asking.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 02:15):

Correction: rt produced similar messages, I just looked over them by accident. I guess that's normal then?

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 05:22):

Ok yeah, so now I think the biggest priorities are to get the appleseed camera set up so that it matches the rt camera. Still can't figure out how to access those rt camera settings though.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:02):

Hey @Sean, sorry to bother you, but for the "more work needed" part, were you referring to just the struct internal part, or did you want me to include that seperate function as well?

view this post on Zulip Sean (Jan 20 2020 at 07:05):

Update to that: franz said that it should be possible, so I'll have to refactor a lot of my code for the next task. One thing I am curious about, though, is how I'll be able to access the camera settings. It would be great if it was just something I could access through rtip or something, but I'll have to look more into it.

The rtip is independent of any camera settings. You can, however, stash any arbitrary user pointers in a variety of BRL-CAD structures including the application struct.

view this post on Zulip Sean (Jan 20 2020 at 07:08):

but I'm not really sure how to interpret them exactly. Are they warnings/issues? They don't appear when I render the same objects with rt, which is why I'm asking.

They are warnings from within LIBRT that a solidity error was detected during ray tracing. You can ignore them for now. There's a way to turn them off, it's rt's -R option.

view this post on Zulip Sean (Jan 20 2020 at 07:09):

Ok yeah, so now I think the biggest priorities are to get the appleseed camera set up so that it matches the rt camera. Still can't figure out how to access those rt camera settings though.

Rt's view settings are in a few variables. The easiest to start with will likely be the -a -e options, following the processing they do and trying to mimic that as that's the base use case.

view this post on Zulip Sean (Jan 20 2020 at 07:12):

Hey Sean, sorry to bother you, but for the "more work needed" part, were you referring to just the struct internal part, or did you want me to include that seperate function as well?

Not at all a bother, just catching up in order to minimize missing important things. The vls one is wrong (happens to work they way you're using it now, but you got lucky ;)), but it's trivial to fix. The separate function is probably the easiest and least amount of code change. Adding another constructor should also work, but then you'll either want to make a function they both call or you'll have some duplication.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:13):

I think my main issue right now would be getting the default camera location. I'm pretty sure I'd need the appleseed and the default rt camera settings to match so that appleseed knows where to look, but it seems to vary based on the size of the objects and such so I'm not sure how rt handles it exactly.

view this post on Zulip Sean (Jan 20 2020 at 07:13):

@Jeffrey Liu so they only thing I want to make sure is that you get to claim your last task(s) in time before the deadline, particularly if you have any other tasks pending.

view this post on Zulip Sean (Jan 20 2020 at 07:15):

You're right, the default render views are based on the approximate size of geometry which is calculated during your rt_prep_parallel() call.

view this post on Zulip Sean (Jan 20 2020 at 07:17):

so you're going to have to calculate the view similarly to how rt's doing it, and then translate to appleseed inputs.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:17):

Jeffrey Liu so they only thing I want to make sure is that you get to claim your last task(s) in time before the deadline, particularly if you have any other tasks pending.

Thank you, I really want to finish up to task 12 if that's possible :) For now, could I submit the task with the bu_vls fix, and then try to add the separate function for task 11?

view this post on Zulip Sean (Jan 20 2020 at 07:17):

you'll want to look at do_frame() in src/rt/do.c, particularly at/after the do_prep() call in there.

view this post on Zulip Sean (Jan 20 2020 at 07:19):

you'll see do_frame() calls grid_setup() ... that's the main workhorse and it's over in worker.c

view this post on Zulip Sean (Jan 20 2020 at 07:20):

you can probably call grid_setup() directly after prep, but it reads a number of global variables that you'll have to make sure have been initialized properly after option parsing (e.g., the globals that -a and -e set).

view this post on Zulip Sean (Jan 20 2020 at 07:22):

in fact, most of the functions even for option parsing, you should be able to call directly

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:23):

I'm still not too sure about the separate function part though - I am passing the database path and object names as part of the ParamArray, but I'd probably have to deal with the whole argument handling thing all over again. I think the main issue is that I can't just pass an array as an input parameter, so something with a space in the name would be especially difficult to deal with.

view this post on Zulip Sean (Jan 20 2020 at 07:23):

passing -a and -e ends up calling do.c's do_ae() function which ends up using the prepped rtip to set eye_model, which grid_setup() ends up using in its calculations.

view this post on Zulip Sean (Jan 20 2020 at 07:27):

I'm not sure I follow the implication. The ParamArray seems fine. You pass it an array of names, which is ideal/fine.

view this post on Zulip Sean (Jan 20 2020 at 07:27):

you REALLY don't want to get into string parsing object names

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:28):

The issue with ParamArray, I think, is that it's part of appleseeds input handling (it's not actually just an array), so there's the issue of handling an unknown number of objects

view this post on Zulip Sean (Jan 20 2020 at 07:28):

spaces was just an example. could have quotes or backslashes or special characters... some of those characters have special meaning. You'd have to encode and decode, which is really ugly (and seems completely unnecessary as you were successful).

view this post on Zulip Sean (Jan 20 2020 at 07:29):

still, what's the problem?

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:31):

So for each parameter in ParamArray, there is a separate function to be called to get the required or optional parameter. When appleseed is writing the project file, it will convert the data type to a string, so for something like an array, which is basically the pointer to the first element, something other than the list of objects might get written to the project file.

view this post on Zulip Sean (Jan 20 2020 at 07:31):

The issue, I thought, was that you extended BrlcadObject::BrlcadObject() with two additional parameters, with an ap and resources

view this post on Zulip Sean (Jan 20 2020 at 07:32):

you insert "objects" into the param array though... which is a MeshObjectsArray

view this post on Zulip Sean (Jan 20 2020 at 07:32):

is "object_names" your creation or appleseed's?

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:33):

"object_names" is my creation, if you look at brlcadplugin you'll see that there's a function named get_objects, which gets a string of the concatenated objects at the moment.

view this post on Zulip Sean (Jan 20 2020 at 07:34):

/me looks

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:36):

you insert "objects" into the param array though... which is a MeshObjectsArray

I think I'm not actually using the MeshObjectsArray anymore, it's just the singular BrlcadObject (which uses the prepped rtip) that's being inserted into the assembly. That's also the ParamArray I'm referring to, which has a database_path and object_names.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:37):

So basically, the only way for me to communicate with BrlcadObject is either through the constructor or through the ParamArray, which looks like this right now:

asf::auto_release_ptr<renderer::Object> brlcad_object(
    new BrlcadObject{"brlcad geometry",
             asr::ParamArray()
             .insert("database_path", file)
             .insert("object_names", objects),
             ap, resources});
    assembly->objects().insert(brlcad_object);

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:39):

If I wanted to pass an array (to later be recorded in the project file), it woud need to be through the ParamArray() where I insert the two required parameters. However, the issue with passing an array, as I mentioned before, is that appleseed would convert it weirdly (I actually tried passing the struct application pointer as a ParamArray parameter at first, but I was getting an error because of the way they were converting the parameters to strings).

view this post on Zulip Sean (Jan 20 2020 at 07:40):

Okay, I see you're not using get_objects() now (and it's not an Object:: method in appleseed)

view this post on Zulip Sean (Jan 20 2020 at 07:40):

though you did pass them nicely, so that's a good thing should you need them

view this post on Zulip Sean (Jan 20 2020 at 07:41):

so I would suggest just keeping it simple and slowish for now -- let the plugin just have the list of objects from object_names and let it prep them as it was doing

view this post on Zulip Sean (Jan 20 2020 at 07:41):

art will also have prepped, but not a big deal yet

view this post on Zulip Sean (Jan 20 2020 at 07:42):

er, what am I saying

view this post on Zulip Sean (Jan 20 2020 at 07:42):

you have it working with your inherited Object class

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:43):

So with that way, it'll probably still have the issue with the spaces because of the weird parsing which separates by space. To be honest, I think how it's being handled right now is fine, seeing as the .appleseed writing is more of a side debugging thing.

view this post on Zulip Sean (Jan 20 2020 at 07:43):

the problem is only when run from within appleseed which is to say that you still need an api-compatible Object constructor that it can call into

view this post on Zulip Sean (Jan 20 2020 at 07:43):

which is the same, just without ap and resources

view this post on Zulip Sean (Jan 20 2020 at 07:45):

and if you call into that constructor, you simply initialize an ap and resources based on object_names and database_path, and call the other constructor (or a common function they both call)

view this post on Zulip Sean (Jan 20 2020 at 07:45):

make sense?

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:46):

Yeah, so it would basically be a combination of the two things that I tried?

view this post on Zulip Sean (Jan 20 2020 at 07:46):

sort of, yes

view this post on Zulip Sean (Jan 20 2020 at 07:46):

so you'll just need to add another constructor, one that conforms to
Object(
const char* name,
const ParamArray& params);

view this post on Zulip Sean (Jan 20 2020 at 07:47):

and to make that work, you'll obviously need TO CREATE an ap (shouldn't need resources, they are stashed in the ap) in that constructor (or in a function that constructor calls)

view this post on Zulip Sean (Jan 20 2020 at 07:48):

art won't use that constructor, which is fine

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:50):

Ok yeah, that seems solid. I normally wouldn't ask of this, but since GCi is approaching its end and task 11 is basically still about rendering geometry, could I submit the bu_vls fix for task 10 and then do this constructor stuff for task 11?

view this post on Zulip Sean (Jan 20 2020 at 07:51):

that's fine

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:51):

Alright thanks so much! I really want to try my hand at task 12 before the task claim deadline.

view this post on Zulip Sean (Jan 20 2020 at 07:52):

I'd also like to work on getting your patches integrated formally now that things are starting to slow down enough

view this post on Zulip Sean (Jan 20 2020 at 07:52):

hopefully you'll keep at this. amazing work :)

view this post on Zulip Sean (Jan 20 2020 at 07:52):

can't wait to see colors :D

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:54):

Colors would be awesome, although I think I'd have to figure out how to position the lights properly and stuff. Right now the geometry is just being lit by the skylight.

view this post on Zulip Sean (Jan 20 2020 at 07:54):

skylight is fine for now, colors are independent assignments. materials.

view this post on Zulip Sean (Jan 20 2020 at 07:55):

you're just using a default material now, but easily extends

view this post on Zulip Sean (Jan 20 2020 at 07:56):

still camera is far more important first, that's why I said hope you keep this up. ;)

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:57):

Of course! There's no way I could leave it now that I'm in this deep.

view this post on Zulip Sean (Jan 20 2020 at 07:57):

there are literally thousands of people that will end up using this when/if it's ever completed. that's why this has been a priority for a while now.

view this post on Zulip Sean (Jan 20 2020 at 07:57):

sparked by a conversation franz and I had at a conference a few years ago

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:58):

I'm hoping that colors are pretty easy to extend - how does rt handle it? It might be a bit more of a challenge if the colors are determined at the time of ray intersection.

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 07:59):

I would definitely love to see this to competion. Implementing it into the build system seems like a whole other monster though.

view this post on Zulip Sean (Jan 20 2020 at 08:00):

colors are a property of the geometry. it's handled in a manner quite similar to appleseed. rt looks at an object's color value and the set shader to figure out what to do next (i.e., how to shade that particular hit point).

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 08:02):

Oh right, right now the project is using the solid color material, which is why I kinda confused myself.

view this post on Zulip Sean (Jan 20 2020 at 08:04):

the final "color" is calculated after ray intersection for both rt and appleseed. rt uses a classic local illumination method where the color is based heavily on the color of the object, the surface normal, whether the light is visible from that point, and a few other things. appleseed uses a classic global illumination model where the color is also based heavily no the color of the object, but it performs a rather different light simulation which is what makes it more realistic looking even with default settings.

view this post on Zulip Sean (Jan 20 2020 at 08:04):

okay, us east coasters should get some rest

view this post on Zulip Sean (Jan 20 2020 at 08:05):

enjoy the holiday tomorrow!

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 08:05):

Yeah I was about to say that it was getting quite late. Thanks so much for your help!

view this post on Zulip Jeffrey Liu (Jan 20 2020 at 08:05):

You too!

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 06:54):

Hey @Sean, I just saw your comment on the task. I could do that, but the real issue is how these object names get recorded in the appleseed project. The BrlcadObject (as I've defined it) requires 3 parameters: a database_path, an object_count, and object_names. The function build_project() passes down the parameters for the database_path and the string for object_names, while object_count found from objc. As I've mentioned before, I can't just pass an array to object_names because it either wouldn't work, or the pointer to the first element would be written to the project file.

view this post on Zulip Sean (Jan 21 2020 at 06:54):

er, when I last looked, object_names is not a string... it was an array.

view this post on Zulip Sean (Jan 21 2020 at 06:55):

(an array of strings)

view this post on Zulip Sean (Jan 21 2020 at 06:55):

maybe I'm misremembering

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 06:56):

I'm first concatenating the object names together with bu_vls_from_args before passing it, and then I'm doing a pretty weird method to ultimately get a (const char**) objv:

char* objv = (char*)bu_calloc(objects.size() + 1, sizeof(char), "obj array parameter");
    strcpy(objv, objects.c_str());

    configure_raytrace_application(dbname.c_str(), objc, objv);

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 06:57):

in configure_raytrace_application():

/* parse object arguments */
    char** objv = (char**)bu_calloc(objc + 1, sizeof(char*), "obj array");
    char* token = strtok(objects, " ");
    int idx = 0;
    while (token != NULL)
    {
    objv[idx++] = token;
    token = strtok(NULL, " ");
    }

    /* include objects from database */
    if (rt_gettrees(rtip, objc, (const char**)objv, npsw) < 0)
    {
    fprintf(output, "Loading the geometry for [%s] FAILED\n", objects);
    fflush(output);
    }

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 06:59):

I have thought about adding more parameters so that each parameter (maybe like "object1_name" or something) could hold a separate object name, but from what I know, this wouldn't really work out if there's an indefinite number of object arguments.

view this post on Zulip Sean (Jan 21 2020 at 07:02):

Ah, I see what threw me -- you used to have:
asr::MeshObjectArray objects

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:02):

Here's the command itself, which gets the required parameter "object_names" from the ParamArray:

std::string
BrlcadObject::get_objects() const
{
    return m_params.get_required<std::string>("object_names");
}

view this post on Zulip Sean (Jan 21 2020 at 07:03):

yeah, I see all that now. I was remembering a previous version I suppose.

view this post on Zulip Sean (Jan 21 2020 at 07:03):

So what was the deal when objects used to be a MeshObjectArray?

view this post on Zulip Sean (Jan 21 2020 at 07:04):

I supposed this comes down to what the API is for ParamArray()

view this post on Zulip Sean (Jan 21 2020 at 07:05):

ParamArray looks to be templatized, so it theoretically could contain any object type

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:05):

I think I was actually using BrlcadObject the whole time, I just had that part commented out so it might've looked like I was using the MeshObjectArray (sorry about that, I probably should've removed it)

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:07):

ParamArray is able to contain any object type, but the problem arises when the .appleseed project file actually records the parameters - the parameter would need to be able to be converted to a string, and it would also need to be something readable after being written

view this post on Zulip Sean (Jan 21 2020 at 07:11):

sure, but that looks like it's something that'd be already handled internally. I'm seeing linkages in ParamArray where it's simply a string Key to a Dictionary value. Those interfaces, at least I would assume, would be where I'd expect serialization/deserialization to be handled consistently.

view this post on Zulip Sean (Jan 21 2020 at 07:11):

maybe just need to find an example.. looking

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:21):

Hm, I haven't really thought to look at any of the builtin appleseed containers, which is probably one of the first things I should've done... I'll take a look at it - I've also asked franz about any possibilities in the meantime.

view this post on Zulip Sean (Jan 21 2020 at 07:30):

yeah, this is a good franz question. I'm actually not finding anything in the way of examples that doesn't serialize to a string.

view this post on Zulip Sean (Jan 21 2020 at 07:31):

so towards that end, I think your earlier suggestion should be workable. just stash them individually with key "object.#"

view this post on Zulip Sean (Jan 21 2020 at 07:32):

and you'll know based on the object_length key how many object.# to extract

view this post on Zulip Sean (Jan 21 2020 at 07:32):

that way it's not limited to any predetermined quantity.

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:33):

Right, the problem with that approach is that I think I'd need to define a "get_object.#" function for each key, so I'm still limited in the end.

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:34):

Just like how these are being called:

std::string
BrlcadObject::get_database() const
{
    return m_params.get_required<std::string>("database_path");
}


int
BrlcadObject::get_object_count() const
{
    return m_params.get_required<int>("object_count");
}


std::string
BrlcadObject::get_objects() const
{
    return m_params.get_required<std::string>("object_names");
}

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:38):

Or actually, maybe what could be done is define a general std::string BrlcadObject::get_object() function that takes an int parameter that's used... it could potentially work

view this post on Zulip Sean (Jan 21 2020 at 07:38):

how so?

view this post on Zulip Sean (Jan 21 2020 at 07:38):

you're the one that calls get_objects()

view this post on Zulip Sean (Jan 21 2020 at 07:38):

so make get_objects() do something differently

view this post on Zulip Sean (Jan 21 2020 at 07:40):

it can call up the count: int count = m_params.get_required<int>("object_count");
and then iterate over for (i=0; i < count; i++) {std::string oname = "object." + i; ... m_params.get_required<std::string>(oname); }

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:41):

Oh, I think what I just mentioned is basically what you were talking about. Sorry, I didn't fully understand what you meant. I don't see why it wouldn't work, so I'll try testing it out when I get the chance.

view this post on Zulip Sean (Jan 21 2020 at 07:42):

and you'd return whatever data structure is the easiest to work with. maybe a std::vector<std::string> or a plain std::string* array or ... etc

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:46):

Yeah that seems like a good plan. Thanks so much your advice!

view this post on Zulip Jeffrey Liu (Jan 21 2020 at 07:47):

I think I'll go to sleep for now, it's getting pretty late. I'll definitely try doing what you mentioned as soon as I can though

view this post on Zulip Jeffrey Liu (Jan 22 2020 at 04:02):

So I was taking a look at worker.c and do.c, but it looks like a lot of it is tied to rtuif and main.c (for example, model2view and view2model are both declared in main.c), so I don't think I can just directly call things like do_ae() or grid_setup(). I think I could just copy those functions into art.cpp and then adjust any variables accordingly for now, if that's fine, unless there's a better way to handle things?

view this post on Zulip Sean (Jan 22 2020 at 04:37):

@Jeffrey Liu You can just call them -- you just need to provide your own model2view and view2model globals defined in some source file.

view this post on Zulip Sean (Jan 22 2020 at 04:38):

defining the globals and just calling the existing functions would be MUCH more preferable to duplicating the code (harder to maintain long-term).

view this post on Zulip Jeffrey Liu (Jan 22 2020 at 11:34):

Yeah, that makes sense. I was worried that some of the stuff would be RTUIF specific, but I guess as long as I don't call those things, it's okay?

view this post on Zulip Jeffrey Liu (Jan 22 2020 at 17:18):

So, a couple updates. Doing what you mentioned with the object_names works as expected - I did have an issue with using a "." (the parameter parsing was weird because '.' is used as a path separator), but franz helped me get it working. I'm still having some trouble linking do.c and worker.c though, because they seem to also require functions that are defined in main.c or view.c (like memory_storage() or view_2init()).

view this post on Zulip Jeffrey Liu (Jan 22 2020 at 17:23):

Also strange how I'm getting some unresolved external symbols between things like do.c and opt.c, since they're both in the project?

view this post on Zulip Jeffrey Liu (Jan 22 2020 at 18:42):

Sorry, actually I didn't notice it before but there is an issue with the object arguments still. Even though they're separated, the object name with a space in the middle still doesn't get loaded. Do I need to add escape sequences for quotation marks to it?

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 04:56):

Hey @Sean , I think I've got the azimuth and elevation math worked out (I'm using rt to see where the camera location would be, and then manually putting it in), so my last step would be to properly call grid_setup(), which I'm still struggling to set up. Could you help me with what I mentioned above?

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 05:12):

For fun: rt perspective render with -a 35 -e 25 havocrt1.png vs art perspective render with -a 35 -e 25

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 05:13):

havoc.png

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 05:14):

I wish there was a better way to render without using skylight though (which doesn't require setting up the lights properly), the geometry is pretty hard to see as of now.

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 06:59):

Just let havoc render out with -a 35 -e 25: havoc.png

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 07:01):

vs rt: havocrtwhole.png

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 07:02):

I changed the aspect ratio a little bit for the art one, which is why it's a bit different.

view this post on Zulip Jeffrey Liu (Jan 23 2020 at 07:04):

this is probably a better comparison: havoc.png

view this post on Zulip Sean (Jan 25 2020 at 05:48):

That's pretty awesome @Jeffrey Liu. Do you know if that's specifically an ortho camera or is it perspective with a wide angle?

view this post on Zulip Jeffrey Liu (Jan 25 2020 at 12:57):

This is a perspective camera with a wide angle, but I think it would be relatively easy to change since appleseed offers a PinholeCamera (perspective) as well as an OrthographicCamera (ortho).

view this post on Zulip Sean (Feb 05 2020 at 22:20):

Hey @Jeffrey Liu I really want to showcase the progress you made on the appleseed front. Do you think you can create a showcase image in appleseed of some brl-cad geometry?

view this post on Zulip Sean (Feb 05 2020 at 22:22):

could be an imported nurbs model from grabcad or perhaps a different sample model (we've shown havoc lots before, maybe m35). maybe ask franz if there's an easy way to create a default skylight or set a material so that it'll look more interesting than the default dark gray object on light blue background.

view this post on Zulip Sean (Feb 05 2020 at 22:22):

(visually interesting, that is ... it's ALL interesting :)

view this post on Zulip Jeffrey Liu (Feb 06 2020 at 01:28):

Sure! To be clear, when you say skylight, you mean some sort of directional light (instead of the ambient sky radiance being used right now), right? I can also set the sky and object material colors for now, so is there anything else you had in mind?

view this post on Zulip Jeffrey Liu (Feb 06 2020 at 01:49):

Or, looking at the appleseed built-in entities again, there's also a sun model. I can test the two to see which works better though.

view this post on Zulip Sean (Feb 08 2020 at 18:14):

@Jeffrey Liu I simply meant changing the rendering parameters so it's not so dark, whether by changing to different ambient light parameters, switching to "sun", or doing something similar that generalizes to other models

view this post on Zulip Sean (Feb 08 2020 at 18:15):

colors would be huge improvement to see since things like m35 and some others would really be impressive

view this post on Zulip Jeffrey Liu (Feb 08 2020 at 18:54):

Ah okay, I'll play around with the lighting to see what looks best. Colors might be a little difficult for now though - I know it's possible, but I'll probably have to take a deeper look into both rt and Appleseed.

view this post on Zulip starseeker (Feb 27 2020 at 19:00):

@Jeffrey Liu Had any more chance to work on this?

view this post on Zulip Jeffrey Liu (Feb 27 2020 at 20:30):

No, sorry :/ hopefully I'll have some more time on my hands next week though

view this post on Zulip starseeker (Mar 14 2020 at 14:04):

@Jeffrey Liu Just wanted to check - what's the state of the art program in the main SVN repo? Can it render that havoc image as-is, or is some of the logic still in patches?

view this post on Zulip Jeffrey Liu (Mar 17 2020 at 12:37):

Shoot, sorry - I just saw this message. I don't completely remember the state of the progress when I last worked on it, but I don't think it's ready yet. For starters, the CMake still needs work because I was compiling the dll manually (brlcadplugin) in my own project.

view this post on Zulip Jeffrey Liu (Mar 17 2020 at 12:38):

Actually, now that I think about it, I think I completely forgot to commit my work (sorry about that!). I'll try to get that done today if I can. At the very least, it will keep the main repo up to date with what I have although the logic still won't be complete.

view this post on Zulip Sean (Mar 19 2020 at 05:58):

Jeffrey Liu said:

Actually, now that I think about it, I think I completely forgot to commit my work (sorry about that!). I'll try to get that done today if I can. At the very least, it will keep the main repo up to date with what I have although the logic still won't be complete.

That would be awesome @Jeffrey Liu ... definitely want to get as much integrated as possible before the code diverges too much. You made awesome progress. We definitely want to keep it moving forward.

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 13:57):

Sorry for such a long delay - I believe all of my latest work has been committed.

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 14:06):

Hi @Mitesh , I saw that you were interested in working on this appleseed project. In the case that I don't get the chance to work on this for a while, here are just some general notes which may help:

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 14:07):

Please tag me if you have any questions, right now there's a lot of manual set up required because the CMake isn't complete.

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 14:10):

Also @Sean , could you let me know if everything committed correctly? I was getting errors because the two new files didn't have their svn:mime-type and svn:eol-style set, so I searched up what was best to use for .cpp and .h files.

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 14:14):

Oops, one last thing I forgot. Just committed a second change - now everything should be up to date.

view this post on Zulip Sean (Mar 24 2020 at 20:09):

@Jeffrey Liu How would I know it's correct or not? :)

view this post on Zulip Sean (Mar 24 2020 at 20:10):

I don't know what you intended to commit, only what you committed

view this post on Zulip Sean (Mar 24 2020 at 20:12):

The commits themselves looked okay. The commit message could have said something more useful as it wasn't informative, but it looked okay at first glance.

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 20:55):

Ah okay, sorry about the message - I wasn't sure about how lengthy I should've made it

view this post on Zulip Jeffrey Liu (Mar 24 2020 at 20:55):

I was just wondering about the svm:mime-type and stuff, because I'm not exactly sure what it's about

view this post on Zulip starseeker (Mar 25 2020 at 00:43):

Woo-hoo! art.png

view this post on Zulip starseeker (Mar 25 2020 at 00:45):

Quick and dirty - just hard-coded the output name - but got an image with: ./bin/art share/db/moss.g all.g

view this post on Zulip starseeker (Mar 25 2020 at 00:49):

@Jeffrey Liu No idea what those changes will do on Windows - only tested on Linux so far.

view this post on Zulip Sean (Mar 25 2020 at 02:07):

Woah, that's awesome @starseeker

view this post on Zulip Mitesh (Mar 25 2020 at 04:04):

Jeffrey Liu said:

Hi Mitesh , I saw that you were interested in working on this appleseed project. In the case that I don't get the chance to work on this for a while, here are just some general notes which may help:

Thank you so much @Jeffrey Liu . I will quickly revise the older things and then try to cover this up

view this post on Zulip Jeffrey Liu (Mar 29 2020 at 16:22):

starseeker said:

Woo-hoo! art.png

Awesome! It's great to see that it works for the most part for other people - I'll see if I can test the Windows side anytime soon.

view this post on Zulip Sean (May 13 2020 at 18:49):

@Jeffrey Liu any chance you could check out the appleseed build on windows? :)

view this post on Zulip Jeffrey Liu (May 15 2020 at 13:22):

Sure thing! Sorry about that... I said I would but I never got the chance. I'll definitely SVN update and try to compile it today. My AP exams are finally over!

view this post on Zulip starseeker (May 15 2020 at 14:02):

@Jeffrey Liu congrats! that's got to be a relief

view this post on Zulip Jeffrey Liu (May 16 2020 at 19:30):

Thanks! It really is, now that I can get back to doing what I'd like to be doing.

view this post on Zulip Jeffrey Liu (May 17 2020 at 06:42):

Sorry about the hold up, I've been trying to compile, but unfortunately it seems like the find_package(Appleseed) still isn't working for me, and I forgot what I set manually in order to get it to work...

view this post on Zulip Jeffrey Liu (May 17 2020 at 06:42):

I tried -DAppleseed_ROOT to the Appleseed directory, but it still didn't work out for some reason, so I'm still testing

view this post on Zulip Jeffrey Liu (May 17 2020 at 08:07):

Ah I finally got it sorted out, I just had to set Appleseed_LIBRARY and Appleseed_INCLUDE_DIR manually.

view this post on Zulip Jeffrey Liu (May 18 2020 at 07:12):

Hm okay, so I'm still running into a couple issues because of the header file. I think the main issue is the fact that art.h is being used in brlcadplugin.cpp as well as art.cpp, even though brlcadplugin.cpp is supposed to compile into a dll while art.cpp uses those dll functions.

view this post on Zulip starseeker (May 18 2020 at 12:12):

@Jeffrey Liu OK, that's not too surprising - Linux let's me do a lot of things that don't work on Windows. You may need to shift some logic around - I took the straightest path to get something running on Linux, which undoubtedly cut too many corners on Windows.

view this post on Zulip Jeffrey Liu (May 18 2020 at 14:33):

Oh wait, it wasn't actually what I thought it was. I had to manually configure the project a little, but after that, just removing the extern "C" part of brlcad_hit() and brlcad_miss() declaration ended up allowing me to build it successfully.

view this post on Zulip Jeffrey Liu (May 18 2020 at 14:34):

Was that something that was necessary for the Linux build?

view this post on Zulip starseeker (May 18 2020 at 15:13):

Probably not - I'll sometimes reflexively add that since it's needed a lot when C++ functions are exposed API.

view this post on Zulip starseeker (May 18 2020 at 15:14):

Go ahead and get it running on Windows - Linux is relatively easy to fix, so we can get it later.

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:45):

Alright, I've finally gotten it to render something again, but it looks like somethings up with the option parsing for some reason. I guess I'll need to look at that first.

view this post on Zulip Sumagna Das (May 19 2020 at 19:46):

i know this is a serious discussion but i have a question

view this post on Zulip Sean (May 19 2020 at 19:46):

related to Appleseed?

view this post on Zulip Sumagna Das (May 19 2020 at 19:47):

is this the art project which started in gci?

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:47):

Yep

view this post on Zulip Sean (May 19 2020 at 19:47):

@Jeffrey Liu that's great to hear

view this post on Zulip Sean (May 19 2020 at 19:48):

did you have to fix anything?

view this post on Zulip Sumagna Das (May 19 2020 at 19:48):

thats so good

view this post on Zulip Sean (May 19 2020 at 19:48):

you should be set up to commit any changes

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:49):

Not too much, I just changed the extern "C" part of a couple function declarations. I have a question about the find_library() and find_path() in FindAppleseed.cmake though - for the HINT keyword, does CMake only check the paths from that path?

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:51):

So what I mean to say is, CMake was having trouble finding appleseed.lib, even though I was providing Appleseed_ROOT. In the end, I had to specify Appleseed_LIBRARY to the actual path, which was {appleseed}/sandbox/lib/appleseed.lib

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:52):

And this is what FindAppleseed.cmake has:

find_library (Appleseed_LIBRARY
    NAMES appleseed
    HINTS
    ${Appleseed_ROOT}
    PATH_SUFFIXES
    lib64
    lib
    )

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:55):

I believe I may have had a similar issue with Appleseed_INCLUDE_DIR as well. I think a simple fix would be to just make the hint a little bit more specific for both, but I'm a bit hesitant because I'm not too experienced with CMake.

view this post on Zulip Jeffrey Liu (May 19 2020 at 19:57):

That said, I'll commit the changes I made for now.

view this post on Zulip Sean (May 19 2020 at 20:35):

All the logic for finding appleseed is in the FindAppleseed.cmake file, and it looks like ROOT is only used as a HINT search path, so you're on the right track. It's strange that it didn't find it if you specified a path containing appleseed.lib

view this post on Zulip Sean (May 19 2020 at 20:37):

The thing to do would be to either run cmake in trace mode or read the output logs in build/CMakeFiles/CMakeError.log to see if maybe there's some reason it failed to find it.

view this post on Zulip Sean (May 19 2020 at 20:37):

if you post your logs here, I can take a look, see if it's anything not obvious

view this post on Zulip Sean (May 19 2020 at 20:38):

you're the only one working in this area, so you're welcome to experiment with changes to the FindAppleseed.cmake file. whatever is needed -- getting 'art' working is kind of a huge deal.. ;)

view this post on Zulip Sean (May 19 2020 at 20:39):

the extern "C" bits sound strange. that may beg for something else depending on what you changed. windows has slightly different linking rules than linux by default in terms of how it resolves dlls and exes.

view this post on Zulip Sean (May 19 2020 at 20:41):

ah, but that's not what's going on here. just saw your commit. yeah, that extern "C" was wrong. it's defined in the cpp file without C linkage.

view this post on Zulip Jeffrey Liu (May 19 2020 at 23:22):

Sean said:

you're the only one working in this area, so you're welcome to experiment with changes to the FindAppleseed.cmake file. whatever is needed -- getting 'art' working is kind of a huge deal.. ;)

Great, I had a couple of things I wanted to try out. I'll try running the CMake again and checking out the output logs first though.

view this post on Zulip Jeffrey Liu (May 19 2020 at 23:25):

On the bright side, I got the option parsing working again!

view this post on Zulip Sean (May 19 2020 at 23:25):

Yeah? what was wrong?

view this post on Zulip Jeffrey Liu (May 20 2020 at 00:14):

Nothing much, it looks like the functions were commented out for the Linux build, and usage.cpp needed to be added.

view this post on Zulip Jeffrey Liu (May 20 2020 at 00:18):

Here's the CMakeError.log, but I don't think there's any mention of appleseed. CMakeError.log

view this post on Zulip Jeffrey Liu (May 20 2020 at 01:02):

Sean said:

All the logic for finding appleseed is in the FindAppleseed.cmake file, and it looks like ROOT is only used as a HINT search path, so you're on the right track. It's strange that it didn't find it if you specified a path containing appleseed.lib

Would it help to specify the HINT paths (like ${Appleseed_ROOT}/src/appleseed}?

view this post on Zulip starseeker (May 20 2020 at 01:11):

If you have a new enough CMake (3.17 I think?) you can pass the --debug-find option to CMake on the command line - that may help debug what's going on with the package searching.

view this post on Zulip Jeffrey Liu (May 20 2020 at 01:30):

Ah, got it - I'll update my CMake and try it out. Thanks!

view this post on Zulip Sean (May 20 2020 at 15:14):

@Jeffrey Liu naming the variable _ROOT may be misleading -- find_library is going to look in the specified directory, which probably isn't the prefix/root that appleseed was configured for but, rather, was something like $prefix/lib or $prefix/share/lib or similar. The find script might do better searching ROOT/lib as the hint.

view this post on Zulip Sean (May 20 2020 at 15:15):

might need to do something similar for the headers

view this post on Zulip Jeffrey Liu (May 23 2020 at 22:27):

Hm yeah, that makes sense. In that case, I do think that FindAppleseed should be updated a little bit.

view this post on Zulip Jeffrey Liu (May 23 2020 at 22:27):

I'll give it a try and see how it works

view this post on Zulip Jeffrey Liu (May 23 2020 at 22:27):

Thanks for the advice!

view this post on Zulip Sean (May 24 2020 at 19:41):

@Jeffrey Liu you're more than welcome to update FindAppleseed.. it almost certainly needs updating if I'm understanding the issue. It was probably written quickly.

view this post on Zulip Sean (May 24 2020 at 19:41):

probably minimal testing too

view this post on Zulip Jeffrey Liu (May 27 2020 at 22:50):

Sean said:

Jeffrey Liu you're more than welcome to update FindAppleseed.. it almost certainly needs updating if I'm understanding the issue. It was probably written quickly.

Alright, so using the more specific paths did actually help CMake find everything properly. There is a slight issue though: the path to appleseed.lib was ${Appleseed_ROOT}/sandbox/lib/vc141/Ship, which I'm pretty sure is specific to MVSC and the debug/release configuration used for Appleseed. I don't think hardcoding that path is a good idea, but I'm not sure how I would be able to efficiently encompass all of the possible paths for different compilers and configurations .

view this post on Zulip Jeffrey Liu (May 27 2020 at 22:51):

I guess just listing them all out could be an option? Or maybe there is some CMake variable to determine platform or configuration that I'm unaware of?

view this post on Zulip Sean (Jun 02 2020 at 07:32):

This is probably a better question for @starseeker but that sounds like a rando-path that Appleseed decided to use (the "Ship" part in particular). I see no mention of it. So it wouldn't be entirely inappropriate for it to be hard-coded at least in a relative path form into the FindAppleseed logic.

view this post on Zulip Jeffrey Liu (Jun 03 2020 at 05:47):

I think the Ship part had to do with the configuration mode, because I also had another Debug directory (which was probably created when I compiled Appleseed in Debug mode). And I believe vc141 is related to something like the MSVC version? That's why I'm a bit reluctant to just directly hardcode that path, because it seems like I'm not accounting for other paths.

view this post on Zulip Jeffrey Liu (Jun 03 2020 at 05:54):

That being said, I guess this is more of a side thing that's a bit lower in priority. I'm thinking of trying to implement the BRL-CAD colors next and see how that works out.

view this post on Zulip starseeker (Jun 03 2020 at 14:10):

@Jeffrey Liu Yeah, I wouldn't worry too much about the Find paths - unless things are reasonably standard in the upstream software that's a challenge, and it's orthogonal to the main effort - if Appleseed rendering fully pans out we'll do what we need to do to to get things set up and working.

view this post on Zulip Sean (Jun 04 2020 at 15:43):

Jeffrey Liu said:

That being said, I guess this is more of a side thing that's a bit lower in priority. I'm thinking of trying to implement the BRL-CAD colors next and see how that works out.

That sounds great! Let me know if you need pointers in working with colors. Colors are a little tricky as objects can have a color attribute set and objects can be categorically colored based on a global color table.

view this post on Zulip Sumagna Das (Jun 04 2020 at 16:08):

(deleted)

view this post on Zulip Sean (Jun 04 2020 at 16:16):

@Jeffrey Liu You'll discover that there's unfortunately not a simple interface yet as colors have kind of evolved over time as needed. There's a TODO item to create such an interface:

* need routine that returns a color given a path, similar to
  rt_comb_get_color() but full path so that inheritance is taken into
  account and colors set correctly.

The closest is probably color_soltab() in src/libged/display_list.c as it has the crux for a given object, but what's needed is something that works on a path.

view this post on Zulip Jeffrey Liu (Jun 09 2020 at 17:35):

Alright thanks! Since school's about to end, I'll have a lot more free time on my hands. I'll start by taking a look at the files you recommended.

view this post on Zulip Jeffrey Liu (Jun 25 2020 at 04:56):

So, I've been looking into it but it looks like implementing colors might be pretty difficult. The issue is that I'd be assigning a material to a single "BRL-CAD object instance," which makes it all the same color. However, this same instance is the same one that initializes all of the BRL-CAD rt stuff, so I'm a bit stuck. I'm certain that appleseed must have some sort of way to manage different colors for a single object instance, but I think that may involve textures instead.

view this post on Zulip Sean (Jun 25 2020 at 12:21):

@Jeffrey Liu appleseed and most modern renderers use a concept of materials to control color. You create a material object, can specify colors there, and set objects to that material.

It's actually more similar to how we use shaders: https://appleseed.readthedocs.io/projects/appleseed-maya/en/master/shaders/material/as_sbs_pbrmaterial.html

view this post on Zulip Sean (Jun 25 2020 at 12:25):

For example, in the initial appleseed setup tutorial where you set up a sphere, if you recall, you specified the Disney material... That's where a base surface color is getting described: https://appleseed.readthedocs.io/projects/appleseed-maya/en/master/shaders/material/as_disney_material.html?highlight=color

view this post on Zulip Sean (Jun 25 2020 at 12:26):

appleseed goes even further where you can then perform color transforms and all sorts of other operations on a material using a shader network, but you can pretty much ignore all of that.

view this post on Zulip Jeffrey Liu (Jul 05 2020 at 00:51):

Right, so my concern was being able to assign multiple colors. I'm pretty sure that currently, only a single material can be assigned to the entire BRL-CAD geometry because of the way the BRL-CAD instance works, so I'm not completely sure how I'd be able to map colors to individual objects and such.

view this post on Zulip Jeffrey Liu (Jul 05 2020 at 01:00):

Worst case scenario, I can try to rewrite art.cpp so that an object instance is created for each object, but I'm not completely sure how the rt resources will be distributed in that case. At the very least, it sounds like there would be a lot more overhead involved when raytracing.

view this post on Zulip Jeffrey Liu (Jul 05 2020 at 01:03):

Another issue involved with that might be initializing the raytracing application again when, for example, the appleseed project is being opened again after art.cpp has already been called.

view this post on Zulip Jeffrey Liu (Jul 05 2020 at 01:08):

However, on the other hand, there are a lot of pros involved with separating each BRL-CAD object into individual instances because it kind of makes more sense intuitively. Colors would be a lot easier to manage, and I imagine it would be easier to manage if different objects were different materials (plastic, glass, etc). if it's possible, I think it could be worth pursuing.

view this post on Zulip starseeker (Jul 05 2020 at 03:33):

If it makes intuitive sense I'd recommend trying it

view this post on Zulip Sean (Jul 08 2020 at 18:40):

Jeffrey Liu said:

Worst case scenario, I can try to rewrite art.cpp so that an object instance is created for each object, but I'm not completely sure how the rt resources will be distributed in that case. At the very least, it sounds like there would be a lot more overhead involved when raytracing.

The way we usually deal with embedded contexts like this is to map at the region level. So you'd create a an art object for each region instead of just the top-level object, calculate bounding boxes for all of them, and appleseed will do it's traversal accordingly.

Performance is unlikely an issue. If anything, region-level lets appleseed be a lot smarter about ray traversal for really complex geometries instead of relying on librt traversal for all rays that get near. Resource-wise, librt should just work and do the right thing -- one plus side of the global resource states.

view this post on Zulip Sean (Jul 08 2020 at 18:41):

there aren't multi-material regions -- by definition they represent a single material, so the mapping to a display material becomes naturally 1-to-1 also, so it should solve that problem as well.

view this post on Zulip Jeffrey Liu (Jul 14 2020 at 21:40):

Right, but if I'm understanding correctly, I feel like it'll be difficult to, say, initialize the rt application and be able to share it among object instances. Right now, since everything is under one object, it's easy for that object to simply just initialize the rt application. Once the regions are split into different objects, I'm struggling to think of a way for that to work out.

view this post on Zulip Jeffrey Liu (Jul 14 2020 at 21:46):

This is the part that concerns me, which is in the constructor, and the resources are object attributes:

ap = static_cast<application*>(bu_calloc(1, sizeof(application), "appleseed"));
    resources = static_cast<resource*>(bu_calloc(1, sizeof(resource) * MAX_PSW, "appleseed"));

    char title[1024] = { 0 }; /* optional database title */
    size_t npsw = 1; /* default number of worker PSWs*/

    /* load the specified geometry database */
    rtip = rt_dirbuild(path, title, sizeof(title));
    if (rtip == RTI_NULL)
    {
    fprintf(output, "Building the database directory for [%s] FAILED\n", path);
    fflush(output);
    }

    for (size_t i = 0; i < MAX_PSW; i++)
    {
    rt_init_resource(&resources[i], i, rtip);
    RT_CK_RESOURCE(&resources[i]);
    }

    /* display optional database title */
    if (title[0])
    {
    fprintf(output, "Database title: %s\n", title);
    fflush(output);
    }

    /* parse object arguments */
    const char** objv = (const char**)bu_calloc(objc + 1, sizeof(char*), "obj array");
    for (int i = 0; i < objc; i++)
    {
        objv[i] = objects.at(i).c_str();
    }

    /* include objects from database */
    if (rt_gettrees(rtip, objc, objv, npsw) < 0)
    {
    fprintf(output, "Loading the geometry for [%s] FAILED\n", objects[0].c_str());
    fflush(output);
    }

    /* Prepare database for raytracing */
    if (rtip->needprep)
    rt_prep_parallel(rtip, 1);

    /* Initialize values in application struct */
    RT_APPLICATION_INIT(ap);

    /* configure raytrace application */
    ap->a_onehit = -1;
    ap->a_rt_i = rtip;
    ap->a_hit = brlcad_hit;
    ap->a_miss = brlcad_miss;

view this post on Zulip Jeffrey Liu (Jul 14 2020 at 21:49):

I guess what I could try doing is making all of those attributes static, and then have a single object instance initialize everything while the others wait for the initialization to complete?

view this post on Zulip Sean (Jul 14 2020 at 21:52):

Jeffrey Liu said:

Right, but if I'm understanding correctly, I feel like it'll be difficult to, say, initialize the rt application and be able to share it among object instances. Right now, since everything is under one object, it's easy for that object to simply just initialize the rt application. Once the regions are split into different objects, I'm struggling to think of a way for that to work out.

Shouldn't be difficult at all, in fact you shouldn't really need to do anything special/different.

view this post on Zulip Sean (Jul 14 2020 at 21:53):

Resources are initialized per cpu core. They have nothing to do with the object or application structure. They're basically book-keeping structures used by librt parallelism.

view this post on Zulip Sean (Jul 14 2020 at 21:54):

so those resource structures just need to be initialized prior to rendering, and provided to the application structure.

view this post on Zulip Sean (Jul 14 2020 at 22:02):

similarly the application structure is once per application, and doesn't need to change. the resources are set into it, which makes it safe for multithreaded ray shooting.

view this post on Zulip Sean (Jul 14 2020 at 22:08):

the only thing that really changes is the interface to appleseed. instead of giving appleseed one bounding box / object, you need to provide a box for each region. they can all be configured to go through the same app structure like they are doing now.

view this post on Zulip Sean (Jul 14 2020 at 22:09):

even the dirbuild shouldn't need to change (this is ultimately what is turned into the rt_i instance that goes into the app structure.

view this post on Zulip Sean (Jul 14 2020 at 22:10):

if you get lost, I can probably give more specific pointers in the code or help work with you on this.

view this post on Zulip Jeffrey Liu (Jul 20 2020 at 07:39):

Ah ok, thank you for the explanation about librt! I think that does clear some confusion. Sorry for taking so long to respond all the time - I've been a bit occupied. I'll take a look at it again as soon as I can.

view this post on Zulip Jeffrey Liu (Jul 20 2020 at 07:42):

I think my main source of confusion was that an object would need to be created for each region, so I wasn't sure how the application structure could be shared, but I guess it can just be kept as a static variable.

view this post on Zulip Sean (Jul 20 2020 at 23:04):

@Jeffrey Liu static var or better if you can find a way to pass it around. I assume appleseed has some sort of data pointer you could set it to. the application structure itself has a user data pointer where you can stash additional information.

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 14:19):

Good point, I'll ask franz if appleseed has anything like that.

view this post on Zulip Sean (Jul 27 2020 at 14:28):

@Jeffrey Liu It should be evident in the existing calls...

view this post on Zulip Sean (Jul 27 2020 at 14:30):

yeah, looks like you already have what you need. instead of a data pointer, he's using inheritance. see how BrlcadObject inherits from asr::ProcecuralObject

view this post on Zulip Sean (Jul 27 2020 at 14:30):

so any data you put into BrlcadObject will be accessible

view this post on Zulip Sean (Jul 27 2020 at 14:30):

you're already stashing ap, rtip, and resources there.

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 14:31):

Ah got it, I'll look into that then.

view this post on Zulip Sean (Jul 27 2020 at 14:31):

they are passed into the constructor for BrlcadObject

view this post on Zulip Sean (Jul 27 2020 at 14:31):

you'll just pass the same ap, rtip, and resources into ALL BrlcadObject objects.

view this post on Zulip Sean (Jul 27 2020 at 14:32):

so BrlcadObject doesn't even need to change

view this post on Zulip Sean (Jul 27 2020 at 14:34):

ah, i take it back -- there are some subtle changes needed. I see the constructor calls configure_raytrace_application, which is where it actually calls rt_dirbuild, initializes the resources, and inits the ap structure. that code needs to get pulled higher up before BrlcadObject is constructed.

view this post on Zulip Sean (Jul 27 2020 at 14:36):

looks like you can pull it into BrlcadObjectFactory::create() once you know the name of the object(s) being rendered

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 14:39):

Ah, I see. Thanks for the advice! I'll test out the Factory creation stuff this week.

view this post on Zulip Sean (Jul 27 2020 at 14:39):

yeah, that should do it. you should definitely be able to init there.

view this post on Zulip Sean (Jul 27 2020 at 14:40):

the only issue might be what you ran into with art.cpp and the plugin calling the two different constructors. look like they both need to call the one art.cpp is using (where rtip, resources, and application struct are passed in)

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 14:42):

Right. But you mentioned that BrlcadObjectFactory::create() might be able to pass the resources in instead, right? Also, if I'm understanding correctly, is it perfectly safe for multiple objects to hold the same rtip, resources, and application struct?

view this post on Zulip Sean (Jul 27 2020 at 14:46):

yeah, it should be safe for them to all hold the same.

view this post on Zulip Sean (Jul 27 2020 at 14:48):

that's why there are resources ... those are CPU resources used during ray tracing.

view this post on Zulip Sean (Jul 27 2020 at 14:53):

the gist is that you create one main app structure where you set the resources and rtip.

view this post on Zulip Sean (Jul 27 2020 at 14:53):

the resources just have to be initialized once per app, from anywhere.

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 14:54):

That makes a lot of sense, I don't know why I initially thought that it would be dangerous for there to be multiple pointers to the same resource. Thank you again for the help!

view this post on Zulip Sean (Jul 27 2020 at 14:55):

the rtip holds a prepped model, which happens once per rendering.

view this post on Zulip Sean (Jul 27 2020 at 14:55):

both rtip and resources are typically set into a single "main" app structure.

view this post on Zulip Sean (Jul 27 2020 at 14:55):

that app structure is then copied for each ray that is fired

view this post on Zulip Sean (Jul 27 2020 at 14:56):

the typical multithreaded use can be see in src/rt/worker.c:do_pixel() ... look for the "struct copy" line where it tells that specific ap which cpu resource to use.

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 15:01):

Ah, I see it. In this case, that's only necessary because it's being multithreaded, right? So in this case, where it's still single threaded at the moment, that's not something I have to worry about yet, is it?

view this post on Zulip Sean (Jul 27 2020 at 16:01):

@Jeffrey Liu you are worrying about it (correctly) already... look at BrlcadObject::intersect() instead of creating a copy of the AP, you just set the resource and call rt_shootray().

view this post on Zulip Sean (Jul 27 2020 at 16:01):

getting the cpu # using get_id()

view this post on Zulip Sean (Jul 27 2020 at 16:02):

if that's not working in parallel, that would probably be because of multiple threads overwriting that resource - creating a copy of the AP should solve it..

view this post on Zulip Sean (Jul 27 2020 at 16:02):

don't think I noticed that before

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 17:06):

Multithreading with appleseed is definitely something I'll be looking into soon. For now though, I'm going to focus on splitting the BRL-CAD object into regions/instances, and then work on the color rendering.

view this post on Zulip Jeffrey Liu (Jul 27 2020 at 17:07):

I remember there was some issue with multithreading before, but I didn't really have the knowledge to debug it at the time. Hopefully, it's something that can be sorted out soon.

view this post on Zulip Sean (Jul 27 2020 at 17:20):

if there was an issue, it's almost certainly that simultaneous use of the same ap structure. each ray should have its own.

view this post on Zulip Sean (Jul 31 2020 at 06:18):

@Jeffrey Liu any progress, need me to help with it? I feel like you're super close!

view this post on Zulip Jeffrey Liu (Aug 06 2020 at 00:45):

Not yet sorry - I've been pretty busy recently and, well, I've also been without power for the past two days. Hopefully I'll get to look at it soon, I definitely have a solid idea as to what needs to be done.

view this post on Zulip Jeffrey Liu (Aug 06 2020 at 00:46):

As a side note, do you think I could create a wikipage for this project at some point? I think it would help me and other contributors keep track of progress, create a to-do list, and so on.

view this post on Zulip Jeffrey Liu (Aug 06 2020 at 01:06):

And... 5 minutes later power is restored. I'll try to take a look at it tonight then.

view this post on Zulip Jeffrey Liu (Aug 06 2020 at 03:50):

Hm ok, so I do have a couple of "questions" and I would like to hear someone else's opinion on some things. Right now, since there's only one overarching object, it stores parameters like the object count and geometry file path. I guess the most straightforward way is just to make it so that each object ends up storing these parameters, but it seems a bit inefficient. Are there any better alternatives?

view this post on Zulip Jeffrey Liu (Aug 06 2020 at 03:52):

Other than that, I think everything else is pretty straightforward - when the appleseed project is opened by appleseed, the BrlcadObjectFactory should be able to configure brlcad raytracing in its constructor, which it can then pass down to the objects.

view this post on Zulip Jeffrey Liu (Aug 13 2020 at 22:05):

@Sean could I ask for your opinion on the details I mentioned above?

view this post on Zulip Sean (Aug 14 2020 at 17:20):

Hi @Jeffrey Liu sorry for the delay, I've been really deep in non-fun non-coding work this past week, so I'm playing catch up.

view this post on Zulip Sean (Aug 14 2020 at 17:23):

A wiki page for tracking progress sounds great! https://brlcad.org/wiki/Appleseed should work great, or could go more wordy like https://brlcad.org/wiki/Appleseed_renderer_integration

view this post on Zulip Sean (Aug 14 2020 at 17:26):

Jeffrey Liu said:

Hm ok, so I do have a couple of "questions" and I would like to hear someone else's opinion on some things. Right now, since there's only one overarching object, it stores parameters like the object count and geometry file path. I guess the most straightforward way is just to make it so that each object ends up storing these parameters, but it seems a bit inefficient. Are there any better alternatives?

Depends what the parameters are, but I wouldn't worry about efficiency unless it's visibly causing a problem. There's a heck of a lot of room to create hundreds of thousands of objects and not have it really affect performance, or for performance to be optimizable in other ways.

view this post on Zulip Sean (Aug 14 2020 at 17:26):

Object count would disappear if there was just one object per object

view this post on Zulip Sean (Aug 14 2020 at 17:27):

geometry file path sounds like a string pointer, which really should only matter for debugging or maybe uniqueness testing on creation.

view this post on Zulip Sean (Aug 14 2020 at 17:29):

Jeffrey Liu said:

Other than that, I think everything else is pretty straightforward - when the appleseed project is opened by appleseed, the BrlcadObjectFactory should be able to configure brlcad raytracing in its constructor, which it can then pass down to the objects.

Remember that there's two modes of operation. There's the 'art' application binary that is intended to be stand-alone and be a drop-in replacement for rt. Then there's the appleseed plugin that hooks into librt and calls it for ray tracing. The 'art' application binary hopefully can use the appleseed plugin (or at least use the same code), but it's not strictly necessary.

view this post on Zulip Sean (Aug 14 2020 at 17:29):

They could be separate code bases if needed.

view this post on Zulip Jeffrey Liu (Aug 16 2020 at 18:41):

Awesome, I'll get started on the wiki soon. I agree with you on the parameters - I guess it isn't that big of a deal. The geometry file path, however, is used by the application in order to actually get the geometry.

view this post on Zulip Jeffrey Liu (Aug 16 2020 at 18:44):

Sean said:

Remember that there's two modes of operation. There's the 'art' application binary that is intended to be stand-alone and be a drop-in replacement for rt. Then there's the appleseed plugin that hooks into librt and calls it for ray tracing. The 'art' application binary hopefully can use the appleseed plugin (or at least use the same code), but it's not strictly necessary.

I'm a bit confused by this. My understanding was that the 'art' application binary isn't necessarily stand-alone, and still uses librt to test intersections with BRL-CAD geometry. It's true that there are two modes to actually render the image (either directly through art.exe or by opening the generated project through appleseed), but don't both methods rely on librt?

view this post on Zulip Sean (Aug 16 2020 at 19:15):

I meant stand-alone in the sense that it's a binary application that isn't reliant upon the appleseed studio runtime, not that it doesn't require librt or appleseed libs.

view this post on Zulip Sean (Aug 16 2020 at 19:15):

both definitely go through librt

view this post on Zulip Jeffrey Liu (Aug 16 2020 at 20:21):

Ah ok, thank you for the clarification! I thought I had mistaken something this whole time. I created the wiki-page at https://brlcad.org/wiki/Appleseed, but I've only updated the to-do list for now. Once I get back to my computer, I'll start on the other sections as well.

view this post on Zulip Sean (Aug 18 2020 at 05:25):

cool, thanks for thinking to document it!

view this post on Zulip Jeffrey Liu (Sep 29 2020 at 22:27):

Hi, sorry for being so inactive recently. I've been pretty caught up in school/college apps, which is why I kinda wanted to document the appleseed progress beforehand.

view this post on Zulip Jeffrey Liu (Sep 29 2020 at 22:38):

Unfortunately, I'm not sure how much I can contribute until maybe even January. However, if anyone is interested on working on the project in the meantime, I'd be happy to provide whatever assistance I can.

view this post on Zulip Sean (Sep 30 2020 at 15:08):

Hi @Jeffrey Liu it's understandable. We're all getting tugged in different directions. Just spent a week with my main dev laptop fully disassembled while I did some repairs/upgrades. Kind of disruptive. :)

view this post on Zulip Sean (Sep 30 2020 at 15:11):

That said, I'll probably be calling on you for some assistance if you think you're not going to be able to work on it through the rest of the year. We can't go too long without progress or the code and knowledge gets stale/lost and puts everything at risk.

You made amazing progress, so hoping to at least get a baseline capability rolled out into user hands (e.g., a colorless single-threaded 'art' binary).

view this post on Zulip Jeffrey Liu (Oct 06 2020 at 17:17):

Sounds good! I'll try to check Zulip as frequently as I can :)

view this post on Zulip Jeffrey Liu (Jan 11 2021 at 16:20):

Sean said:

That said, I'll probably be calling on you for some assistance if you think you're not going to be able to work on it through the rest of the year. We can't go too long without progress or the code and knowledge gets stale/lost and puts everything at risk.

You made amazing progress, so hoping to at least get a baseline capability rolled out into user hands (e.g., a colorless single-threaded 'art' binary).

Hi, just wanted to check-in to say that I should have some more time on my hands now - I'll take a look at the source code again and catch up on what it is I was planning on doing! Now kinda glad that Appleseed wiki was created.

view this post on Zulip starseeker (Jan 14 2021 at 14:00):

@Jeffrey Liu How's it looking?

view this post on Zulip Sean (Feb 03 2021 at 03:38):

@Jeffrey Liu Ditto, glad to hear you have more time on your hands! Me too soon, woot!

view this post on Zulip Jeffrey Liu (Feb 13 2021 at 19:51):

That's great to hear! Sorry, for some reason I didn't receive any Zulip notifications. I've still been a little busier than anticipated, and taking a few months away definitely made me forget my understanding about a lot of the code, but hopefully I'll have something commit-worthy in a week or two.

view this post on Zulip Jeffrey Liu (Feb 14 2021 at 18:12):

so I tried SVN updating to the latest commit and rerunning CMake, but I'm getting a strange error where it says some .g object already exists in db/*, but when I check db\, only their .asc counterparts are there. Am I using CMake incorrectly here?

view this post on Zulip Erik (Feb 14 2021 at 18:34):

.asc would be the source directory, are you using the src root as your build dir?

view this post on Zulip Jeffrey Liu (Feb 14 2021 at 19:47):

I believe I was in \build but I'll check again. Thank you!

view this post on Zulip Jeffrey Liu (Feb 14 2021 at 23:03):

I was in the src_root\build directory when using CMake.

view this post on Zulip starseeker (Feb 14 2021 at 23:20):

First suggestion is to make sure you're building from a clean build dir - there are lots of strange intermediate states that are hard to diagnose if the generated CMake outputs and the CMake build files aren't in sync.

view this post on Zulip Jeffrey Liu (Feb 14 2021 at 23:58):

Alright thanks, I guess I'll just do that then. I was just concerned that Ill forget about files that I manually arranged for Appleseed.

view this post on Zulip starseeker (Feb 15 2021 at 00:03):

You can always make a new build directory and leave the old one, unless you're too tight on space

view this post on Zulip Jeffrey Liu (Feb 15 2021 at 04:22):

I think I'll do that actually -- thank you for the idea!

view this post on Zulip Sean (Feb 18 2021 at 07:12):

Any progress building appleseed @Jeffrey Liu ? I haven't checked their latest in a while...

view this post on Zulip Jeffrey Liu (Feb 18 2021 at 19:28):

Do you mean the Appleseed repository itself? I haven't tried building it recently, but the appleseed project in BRL-CAD seems to build with enough configuration.

view this post on Zulip Sean (Feb 19 2021 at 07:44):

you mean it builds against the latest appleseed? That's good to know, even better actually. :)

view this post on Zulip Jeffrey Liu (Feb 21 2021 at 15:59):

Ah I just meant I haven't built the latest appleseed recently. I can try to after finishing my changes; I don't suspect it should affect the work in any way.

view this post on Zulip Jeffrey Liu (Feb 21 2021 at 16:39):

So I'm encountering another dilemma when trying to split the regions into separate appleseed objects. rtip is supposed to load the geometry instance into the application structure, but since each appleseed object is now only supposed to specify a specific region of the BRL-CAD geometry, it seems like I can't just load the same raytrace instance for each appleseed object (or else the raytracing will always intersect the same geometry for each appleseed object). Is there any way to circumvent this?

view this post on Zulip Jeffrey Liu (Feb 21 2021 at 16:41):

One idea that comes to mind is to prepare different rtips for each object, and then set ap.a_rt_i = rtip before intersecting each object. However, that sounds pretty inefficient and it seems like it would cause issues if multithreading were ever implemented.

view this post on Zulip Jeffrey Liu (Feb 21 2021 at 16:42):

Any thoughts?

view this post on Zulip Sean (Feb 23 2021 at 20:08):

@Jeffrey Liu first thought is that while using the same rtip will result in it always testing against the same geometry, it should/could still work like that. Not optimal of course performancewise, but it shouldn't be a problem. You'd just have to filter on only regions of interest for each appleseed object.

view this post on Zulip Sean (Feb 23 2021 at 20:13):

I think you're on the right track with the latter approach, though -- you can have a different rtip (and matrix) for each region and a corresponding appleseed object that sets that rtip during setup.

view this post on Zulip Sean (Feb 23 2021 at 20:14):

Note multithreaded access of rtip isn't/shouldn't be a problem -- librt accesses rtip in parallel as it is. You'll just have to map threads to a cpu identifier and make sure librt "resources" are initialized.

view this post on Zulip Sean (Feb 23 2021 at 20:21):

Note that breaking things up by region really isn't any different than supporting multiple render paths. Given appleseed is driving, you will have an application instance for each thread, so there's not contention within that structure. The rtip structures can be accessed in parallel by multiple threads just fine, so you'll just have an rtip for each region and set it in that thread-specific application structure.

view this post on Zulip Sean (Feb 23 2021 at 20:21):

Make sense?

view this post on Zulip Jeffrey Liu (Mar 08 2021 at 05:30):

I think so... Sorry for such a late response. So would you recommend using a different rtip for each region, or using a filter on regions of interest? If it's the latter, is there an example I could use as reference?

view this post on Zulip Sean (Mar 08 2021 at 14:35):

I'd do a diff rtip per region.

view this post on Zulip Jeffrey Liu (Jul 14 2021 at 22:58):

Hi, sorry again for not being able to work for so long - work, school, and college has really been a lot to handle. On the bright side, I got a new laptop so hopefully compiling things won't be an overnight process anymore, and developing things can be a bit more enjoyable. Although I can't guarantee that I'll be able to contribute anytime soon, I just wanted to catch up on things. I noticed that we switched over to GitHub - does our development process still involve committing directly to master?

view this post on Zulip starseeker (Jul 15 2021 at 17:59):

Yes, it does - trunk in SVN == main in Git

view this post on Zulip Jeffrey Liu (Jul 15 2021 at 23:15):

Cool, thanks!

view this post on Zulip Sean (Jul 18 2021 at 20:31):

For now, yes, but you are welcome to work in a branch or work via pull requests to involve others, etc. Whatever works for you.

view this post on Zulip Jeffrey Liu (Jul 19 2021 at 05:19):

Just built BRL-CAD again - went from an overnight built to a 20 minute build :)

view this post on Zulip Jeffrey Liu (Jul 19 2021 at 05:20):

I am getting one error for distcheck though, I feel like I had this error before but I forgot if it was a problem or not.

view this post on Zulip Sean (Jul 20 2021 at 06:37):

What's the error?

view this post on Zulip Jeffrey Liu (Jul 20 2021 at 15:05):

I believe the error said something like the repo does not match the dist or something - I'll try compiling again to see what it is

view this post on Zulip Jeffrey Liu (Jul 20 2021 at 15:12):

This is it: CUSTOMBUILD : error : Distcheck cannot proceed until build files and repo are in sync (set 3> -DFORCE_DISTCHECK=ON to override)

view this post on Zulip starseeker (Jul 20 2021 at 21:27):

I may have fixed that earlier today - does latest main work?

view this post on Zulip Jeffrey Liu (Jul 20 2021 at 22:27):

I'll try again right now!

view this post on Zulip Jeffrey Liu (Jul 20 2021 at 22:28):

Also something I've never really figured out concretely - when a CMakeLists.txt gets updated, what exactly do I need to "refresh?" Should I delete the whole build directory and try again? I've tried to run cmake .. again in the same build file, but it always seems like the generation or configuration never gets updated properly.

view this post on Zulip bch (Jul 20 2021 at 22:28):

Tip of git main endeavours to always be buildable, and is recommended place from which to build new work?

view this post on Zulip Jeffrey Liu (Jul 20 2021 at 22:30):

bch said:

Tip of git main endeavours to always be buildable, and is recommended place from which to build new work?

Yes, I believe this is true but it may not always be tested across all platforms

view this post on Zulip bch (Jul 20 2021 at 22:51):

@starseeker @Sean - is this at least an informal policy?

view this post on Zulip Jeffrey Liu (Jul 20 2021 at 22:53):

starseeker said:

I may have fixed that earlier today - does latest main work?

just pulled and built, seems like there aren't any errors this time

view this post on Zulip starseeker (Jul 21 2021 at 00:39):

tip of main is not guaranteed to always be building, but usually will be. Part of the motivation for moving to Github was to leverage the CI system they have created, and we are starting to do so.

view this post on Zulip starseeker (Jul 21 2021 at 00:42):

@Jeffrey Liu The reason it failed for you earlier was because you were doing a distcheck build, and the main CI build doesn't run the full distcheck process. I just added a test that will catch the most typical reason for a distcheck failure (failing to list files for the repository verification, which was the failure you were seeing.)

view this post on Zulip starseeker (Jul 21 2021 at 00:42):

https://github.com/BRL-CAD/brlcad/actions

view this post on Zulip starseeker (Jul 21 2021 at 00:43):

For example, the latest results are at: https://github.com/BRL-CAD/brlcad/actions/runs/1050498354

view this post on Zulip starseeker (Jul 21 2021 at 00:43):

You can see the steps that are being run at https://github.com/BRL-CAD/brlcad/blob/main/.github/workflows/check.yml

view this post on Zulip starseeker (Jul 21 2021 at 00:45):

That's an evolving process - as I learn new tricks I'm adding more steps (for example, I recently enabled the Qt build elements for testing.)

view this post on Zulip starseeker (Jul 21 2021 at 00:46):

The runners will time out if they go too long, so individual tests can only be so long. (A complete distcheck-full, for example, would be WAAAY too much...)

view this post on Zulip starseeker (Jul 21 2021 at 00:51):

@Jeffrey Liu The most reliable thing to do is delete the build directory and start fresh. In many cases you don't have to, but there are situations where stale outputs can cause problems. If you're seeing strange issues, a clean build is always the first thing to test.

view this post on Zulip Jeffrey Liu (Jul 21 2021 at 03:13):

That makes sense, I was just wondering if there was any faster way because it still does add up to quite some time. As for the distcheck build, I was just building the generated CMake solution for VS 2019 - should I be building the ALL_BUILD project?

view this post on Zulip Jeffrey Liu (Jul 21 2021 at 03:13):

Also am a little curious about how all the CI stuff works, I haven't really worked with CI/CD stuff but am definitely interested

view this post on Zulip Sean (Jul 21 2021 at 05:21):

bch said:

starseeker Sean - is this at least an informal policy?

Yes, that is our policy (HACKING mentions it as well). Devs committing to main are expected to at least reasonably expect that their changes compiles on the platform they're using, not knowingly break other platforms, and to respond/fix quickly or revert when informed of changes they made do break other platforms.

view this post on Zulip Sean (Jul 21 2021 at 05:22):

The STABLE branch takes that a step further, nominally asserting that it compiles cleanly across multiple platforms and not allowing direct commits/merges without multiplatform testing.

view this post on Zulip starseeker (Jul 21 2021 at 12:46):

Yes, you'll want to build the ALL_BUILD target for Visual Studio. You don't have to build the distcheck target for day to day development - you can just do "make -j8" or "ninja" (if you're configuring using the Ninja generator (cmake -G Ninja) - ninja can sometimes build faster than make.)

view this post on Zulip starseeker (Jul 21 2021 at 12:53):

https://docs.github.com/en/actions

view this post on Zulip starseeker (Jul 21 2021 at 12:54):

CI/CD is a general concept - Actions are just Github's implementation - but for the moment they're the system we're targeting.

view this post on Zulip Jeffrey Liu (Jul 21 2021 at 19:35):

Cool, thanks for letting me know!

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 06:08):

Hm, trying to override the Z-lib and PNG libraries with this:

cmake .. -DAPPLESEED_ROOT="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed" -DBRLCAD_PNG=SYSTEM -DBRLCAD_ZLIB=SYSTEM -DZLIB_LIBRARY="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\zlib-debug\lib\zlibd.lib" -DZLIB_INCLUDE_DIR="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\zlib-debug\include" -DPNG_LIBRARY="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\libpng-debug\lib\libpng16_staticd.lib" -DPNG_PNG_INCLUDE_DIR="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\libpng-debug\include"

but the CMake is still telling me that Z-lib isn't found... any ideas?

view this post on Zulip starseeker (Aug 20 2021 at 13:19):

Hmm. I've not tried overriding on WIndows in that particular way - what if you set ZLIB_ROOT to the parent directory of the zlib installation?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 13:41):

Interesting, I'll try that out. I just did it that way since it seemed like those were the two variables missing.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 13:42):

Well, looks like it worked - thanks!

view this post on Zulip Sean (Aug 20 2021 at 15:19):

I wonder if that's the same issue I've run into with zlib... There's some build configuration I keep running into where I get zlib NOTFOUND even though it was set to bundled. I've only run into it 2 times I think, and each time was fixed by just doing it again. Maybe a race/ordering issue? Or something with the depth and subbuilds?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 16:22):

I don't think I'm familiar enough with CMake to know why ZLIB_ROOT works instead, but maybe it's also because CMake expects to automatically generate the two variables?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 16:24):

Also strange, when building Debug mode:

-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PNG_LIBRARY_RELEASE (ADVANCED)
    linked by target "libged-static" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/libged
    linked by target "libged" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/libged
    linked by target "libdm" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/libdm
    linked by target "libdm-static" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/libdm
    linked by target "libicv" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/libicv
    linked by target "libicv-static" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/libicv
    linked by target "fb-png" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/fb
    linked by target "png-fb" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/fb
    linked by target "bw-png" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/util
    linked by target "pix-png" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/util
    linked by target "png-bw" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/util
    linked by target "png-pix" in directory C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/brlcad/src/util

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

I'm curious, does it matter which library is used when building Debug/Release? Just to be safe, I've been trying to use all the debug libraries built by appleseed, but this message clearly specifies Release.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 16:25):

Here's the CMakeCache:

//Directory containing libpng headers.
PNG_INCLUDE_DIRS:STRING=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/libpng-debug/include

//libpng
PNG_LIBRARIES:STRING=PNG_LIBRARY_RELEASE-NOTFOUND

//Path to a library.
PNG_LIBRARY_DEBUG:FILEPATH=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/libpng-debug/lib/libpng16d.lib

//Path to a library.
PNG_LIBRARY_RELEASE:FILEPATH=PNG_LIBRARY_RELEASE-NOTFOUND

//Path to a file.
PNG_PNG_INCLUDE_DIR:PATH=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/libpng-debug/include

//No help, variable specified on the command line.
PNG_ROOT:UNINITIALIZED=C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\libpng-debug

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 16:28):

So the debug library is being found, which makes sense because I set the root directory as the libpng-debug directory, but it's also asking for release?

view this post on Zulip starseeker (Aug 20 2021 at 16:40):

That's strange - libged is using PNG_LIBRARIES, which is supposed to be set in src/other/ext/png.cmake to either the png target (if building bundled) or (if defined) ${PNG_LIBRARY_RELEASE} or ${PNG_LIBRARY_DEBUG} - i.e., the contents of those variables.

view this post on Zulip starseeker (Aug 20 2021 at 16:41):

Debug builds of MSVC compilations aren't redistributable, so unless we're in a very specific debugging scenario where we need to walk into the png library we want the release build.

view this post on Zulip starseeker (Aug 20 2021 at 16:43):

It looks as if the test "if (DEFINED PNG_LIBRARY_RELEASE)" is passing despite PNG_LIBRARY_RELEASE having a "NOTFOUND" value.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 16:44):

Ah okay, so in general, is it better to use the release version for these libraries?

view this post on Zulip starseeker (Aug 20 2021 at 16:44):

@Jeffrey Liu in src/other/ext/png.cmake try changing the last block setting PNG_LIBRARIES to the following:

  if (PNG_LIBRARY_RELEASE)
    set(PNG_LIBRARIES ${PNG_LIBRARY_RELEASE} CACHE STRING "libpng" FORCE)
  else (PNG_LIBRARY_RELEASE)
    set(PNG_LIBRARIES ${PNG_LIBRARY_DEBUG} CACHE STRING "libpng" FORCE)
  endif (PNG_LIBRARY_RELEASE)

view this post on Zulip starseeker (Aug 20 2021 at 16:45):

If that works we'll need to update the logic in the repo - I hadn't noticed that a NOTFOUND setting would also result in DEFINED passing, but it seems it does.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 16:45):

Sounds good, I'll try it and rerun Cmake right now.

view this post on Zulip starseeker (Aug 20 2021 at 16:55):

Looks like I'm just always using ZLIB_LIBRARY_RELEASE in the zlib.cmake logic - I suppose I should do the same thing as we do for PNG so it's consistent.

view this post on Zulip starseeker (Aug 20 2021 at 16:56):

What I can probably do is use the DEFINED test on ZLIB_LIBRARIES and PNG_LIBRARIES to see if the user has specified something in particular and not override it - otherwise, go with release if defined and if that doesn't work try debug.

view this post on Zulip starseeker (Aug 20 2021 at 16:58):

In retrospect I'm not surprised there are some kinks in this part of the logic - system installs of libs on Windows is a relatively uncommon build scenario, and not one I'm well set up to test.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 17:04):

I think it worked, the CMake generation succeeded and I'm compiling now.

view this post on Zulip starseeker (Aug 20 2021 at 17:09):

@Jeffrey Liu I pushed an update to the zlib and png logic - when you get a chance if you can try from a clean build directory and see if that works it would be helpful :-)

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 17:22):

Ugh, still an error with ZLib - looks like the include directory isn't actually being set properly. Will pull the changes and try a fresh build.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 17:34):

CMake looks good so far I think... compiling again.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 17:41):

I keep getting this error, even though I'm setting ZLIB_ROOT?
424>C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\brlcad\src\other\openNURBS\opennurbs_zlib.h(42,10): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 17:42):

This is the Cmake cache, not entirely sure what it means:

ZLIB_INCLUDE_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: ZLIB_LIBRARY_DEBUG
ZLIB_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: ZLIB_LIBRARY_RELEASE
ZLIB_LIBRARY_RELEASE-ADVANCED:INTERNAL=1```

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 17:43):

Also just a note, these compilation errors are being caused when trying to build appleseed with this command: cmake .. -DAppleseed_ROOT="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed" -DBRLCAD_PNG=SYSTEM -DBRLCAD_ZLIB=SYSTEM -DZLIB_ROOT="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\zlib-debug" -DPNG_ROOT="C:\Users\JeffL\Desktop\Open-Source\BRL-CAD\appleseed\windows-deps\stage\vc141\libpng-debug" -DCMAKE_BUILD_TYPE=Debug

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 18:12):

Weird, I ran CMAKE with the -LA flag enabled, and this was printed:

ZLIB_INCLUDE_DIR:PATH=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/zlib-debug/include
ZLIB_INCLUDE_DIRS:STRING=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/zlib-debug/include
ZLIB_LIBRARIES:STRING=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/zlib-debug/lib/zlibd.lib
ZLIB_LIBRARY_DEBUG:FILEPATH=C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/zlib-debug/lib/zlibd.lib
ZLIB_LIBRARY_RELEASE:FILEPATH=ZLIB_LIBRARY_RELEASE-NOTFOUND

which should mean that the include directory was set properly, right?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 18:18):

Seems like it's the compiler error for a ton of different projects too...

view this post on Zulip starseeker (Aug 20 2021 at 19:38):

So there is a zlib.h in vc141/zlib-debug/include ?

view this post on Zulip starseeker (Aug 20 2021 at 19:41):

You can check what the openNURBS part of the build is seeing by putting the following in src/other/openNURBS/CMakeLists.txt:

message("ZLIB_INCLUDE_DIRS: ${ZLIB_INCLUDE_DIRS}")

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 19:43):

Yeah, I can definitely see it through the file explorer. I think the issue is also occurring in other projects aside from openNURBs too though.

view this post on Zulip starseeker (Aug 20 2021 at 19:44):

Can you check the visual studio project to make sure it does in fact have the include directory set?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 19:50):

This is what it says, but I'm pretty sure most CMake projects end up doing this:
$(VC_IncludePath);$(WindowsSDK_IncludePath);

view this post on Zulip starseeker (Aug 20 2021 at 19:59):

@Jeffrey Liu Can you try the ninja generator?

view this post on Zulip starseeker (Aug 20 2021 at 20:03):

fwiw, I just tried pointing my Linux build to appleseed and it did find it and build (crashes at runtime, but does appear to try and do something...)

view this post on Zulip starseeker (Aug 20 2021 at 20:06):

The ZLIB_INCLUDE_DIRS above looks OK, assuming the file zlib.h is in fact present in appleseed/windows-deps/stage/vc141/zlib-debug/include

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 20:17):

starseeker said:

Jeffrey Liu Can you try the ninja generator?

Sorry I've never done this before, is there a resource I could reference?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 20:21):

Yeah, printing the include directory also works:
OPENNURBS: ZLIB_INCLUDE_DIRS: C:/Users/JeffL/Desktop/Open-Source/BRL-CAD/appleseed/windows-deps/stage/vc141/zlib-debug/include

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 20:26):

This is so weird, I can even open zlib.h perfectly fine through VS2019, when trying to jump to it through openNURBS_zlib.h. I'm trying to recompile again but my hopes aren't high.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 20:40):

My guess is, even though some projects don't depend on Zlib, including OpenNURBS adds an inherent dependency because opennurbs.h includes opennurbs_zlib.h itself.

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 20:41):

I wonder why this is only an issue when manually specifying Zlib though?

view this post on Zulip Jeffrey Liu (Aug 20 2021 at 21:45):

Tried to cheat and add ${ZLIB_INCLUDE_DIRS} to the ${OPENNURBS_INCLUDE_DIRS} definition, but it didn't seem to work. I'm not sure how to find a workaround for this...

view this post on Zulip starseeker (Aug 21 2021 at 11:24):

@Jeffrey Liu for Ninja on Windows, here are some starting points:

https://cmake.org/pipermail/cmake/2019-May/069457.html
https://cmake.org/pipermail/cmake/2019-May/069459.html
https://github.com/rwols/CMakeBuilder/wiki/Ninja-for-Windows-Installation-Instructions
https://docs.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2019

view this post on Zulip Sean (Aug 24 2021 at 05:34):

starseeker said:

It looks as if the test "if (DEFINED PNG_LIBRARY_RELEASE)" is passing despite PNG_LIBRARY_RELEASE having a "NOTFOUND" value.

According to the docs, that's the correct behavior for "if (defined VAR)" as it says that takes no regard to the value, unlike if (VAR) that will consider NOTFOUND as false. Was it supposed to be "if (VAR)"?

view this post on Zulip Sean (Nov 02 2021 at 15:57):

Some appleseed rendering progress pics..
image.png
image.png

view this post on Zulip Sean (Dec 02 2021 at 17:06):

More progress! merged_4.gif

view this post on Zulip Jeffrey Liu (Dec 03 2021 at 19:49):

that looks awesome! could I ask what changes have been made?

view this post on Zulip Sean (Dec 05 2021 at 05:19):

@Jeffrey Liu YES! The biggest is probably that it now walks the hierarchy and registers each region individually with appleseed.

view this post on Zulip Sean (Dec 05 2021 at 05:20):

that required creating a bounding box callback in the plugin so each object would report its box correctly (pre-computed on the art side)

view this post on Zulip Sean (Dec 05 2021 at 05:21):

another big change was getting shaders working, so you can specify an OSL shader, specify per-object colors, etc.. that took some doing. there's even a path (still not fully hooked up, but looks like it'll work) for going from materialx shaders to osl shaders.

view this post on Zulip Sean (Dec 05 2021 at 05:22):

chris also got a handful of rt's command-line options working including the az/el options for setting the view, background color, the set command, the number of samples to use

view this post on Zulip Jeffrey Liu (Dec 05 2021 at 21:04):

that's so cool! those were like the main few things on to-do list right? I'll try to read through the commits on the pull request to catch up on things

view this post on Zulip Jeffrey Liu (Dec 15 2021 at 20:45):

@Sean I'll be on winter break after my last final in a few days - is there anything I can contribute to the appleseed project at the moment? I was originally planning on completing stuff from the to-do list on the wiki, but it seems like a lot of that has already been completed.

view this post on Zulip starseeker (Dec 21 2021 at 01:52):

@Jeffrey Liu Unless Sean chimes in, you might want to take a look at the process of translating to/from Y up and Z up coordinate systems. From what I was told, there are still some issues lurking in that part of the logic.

view this post on Zulip starseeker (Dec 21 2021 at 01:52):

Also, I don't think threading is enabled yet.

view this post on Zulip Jeffrey Liu (Dec 21 2021 at 05:46):

Got it, thanks - I'll try taking some time to set it up after the new year and see if I can contribute anything.

view this post on Zulip Jeffrey Liu (Jan 05 2022 at 04:41):

Just chiming in again, in case there's anything I can do: is this where I can find the most updated version of the progress so far? https://github.com/BRL-CAD/brlcad/pull/11. I just wanted to make sure if this was the right place to look.

view this post on Zulip Sean (Jan 08 2022 at 06:48):

@Jeffrey Liu the latest is actually mixed in that PR and another bigger monster PR. I need to pull them out, but working on multithreading should be pretty isolated if you want to give that a go... that would be awesome!

view this post on Zulip Jeffrey Liu (Jan 08 2022 at 08:04):

Sounds good! should I wait for your merge then?

view this post on Zulip Sean (Mar 12 2022 at 19:30):

just for awareness, I wrote up detailed appleseed plugin compilation steps at https://brlcad.org/wiki/Appleseed#Compiling_.27art.27

view this post on Zulip Sean (Mar 12 2022 at 19:31):

@Jeffrey Liu I'm merging the monster patch today finally, so should be good to go. I also updated the wiki page with status since several of the big items were resolved.

view this post on Zulip Jeffrey Liu (Mar 13 2022 at 21:05):

Awesome, I'll try to check it out and recompile this week. Do you know if any student has shown interest in this project for GSoC 2022?

view this post on Zulip Sean (Mar 15 2022 at 14:55):

@Jeffrey Liu none so far, but we do have a team of students in Texas working on it. there's also an appleseed project someone could propose or work on that would greatly help: https://github.com/opencax/GSoC/issues/64

view this post on Zulip Sean (Mar 15 2022 at 14:56):

If nobody proposes it, we'll likely have to do at least parts of that so we can do release builds..

view this post on Zulip Sean (Mar 22 2022 at 22:33):

Looks like fixing Z-up vs Y-up is going to be as simple as rotating the camera! f7e42faa-e9eb-4fe5-81ba-9457550adae3.jpg

view this post on Zulip Sean (Apr 29 2022 at 02:44):

Ortho camera...
m35.png

view this post on Zulip Sean (Apr 29 2022 at 12:01):

toyjeep_cc.png

view this post on Zulip Sean (Apr 30 2022 at 19:40):

NURBS model
hydrant_cc.png

view this post on Zulip Sean (Feb 22 2023 at 06:26):

This looks really cool, potentially useful for appleseed rendering..
https://physicallybased.info

view this post on Zulip starseeker (Sep 14 2023 at 12:42):

Does anybody happen to know if BRL-CAD's use of Appleseed still requires Embree? Or can we skip that dependency since we're using our ray intersections?

view this post on Zulip Sean (Sep 14 2023 at 13:25):

Needs it. It’s been a while since I looked but I believe it’s still using embree for the highest level spatial partitioning and traversal until it encounters a BRL-CAD entity. You also could have non BRL-CAD entities in the scene.

view this post on Zulip starseeker (Sep 14 2023 at 13:45):

Got it.

view this post on Zulip starseeker (Sep 14 2023 at 13:47):

@Sean are the updates to Appleseed that are pending upstream submission anywhere I can access? I don't want to jinx myself but on Linux I've managed to build the newest versions of the dependencies listed at https://github.com/appleseedhq/linux-deps/releases so I'm curious to try building Appleseed proper.

view this post on Zulip starseeker (Sep 14 2023 at 13:49):

I still need to handle flex/bison, which apparently are needed by OSL, and do a systematic check to see if I've inadvertently pulled in system libs anywhere I shouldn't (not to mention actually testing if any of the built stuff actually works...)

view this post on Zulip starseeker (Sep 14 2023 at 13:50):

And "mean" doesn't even begin to describe what a full build of all of this looks like - it's a 17 gig build directory even without Appleseed proper (hi LLVM...)

view this post on Zulip starseeker (Sep 14 2023 at 13:53):

(Don't worry, I'm doing all this in a fork of brlcad_externals - I'm not moving that one beyond the existing set until we get things tied off for switching over.)

view this post on Zulip Sean (Sep 14 2023 at 14:01):

Some of it is that some of it isn’t. There’s a pull request and get hub that has most of the python changes but some of the cmake changes I just have locally as I wasn’t trying to be clean. I don’t think the student was able to figure it out but then you can probably figure it out faster than he did, some of the dependencies changed name and their variables changed others split to separate things so variables need to get updated. I think Boost needed a couple flags.

view this post on Zulip Sean (Sep 14 2023 at 14:03):

There’s also a pending pull request with a bunch of Mac changes, or at least there was. One of the guys might have pulled that one in.

view this post on Zulip starseeker (Sep 14 2023 at 14:04):

Got it. OK, I'll try to at least rough out the logic for flex/bison and then give it a go - thanks!

view this post on Zulip Sean (Sep 14 2023 at 14:10):

Sounds good. I’d like to push back a few clean and easy unambiguous pull requests to hopefully earn some direct commit trust. There’s not been an ounce of pushback but it’d be nice to help more directly and not have to sync.

view this post on Zulip starseeker (Sep 14 2023 at 14:12):

I hadn't looked in a while - the upstream has been really quite since 2020. Not too surprising if you look at the lead dev's day job since then I guess...

view this post on Zulip Sean (Sep 14 2023 at 14:14):

Yeah I talked to Franz in private a few time since then. Pandemic casualty like many other open source projects. He just has zero time.

view this post on Zulip Sean (Sep 14 2023 at 14:16):

There’s about four other guys that are basically either active as needed (that is, they will respond and act) or in maintenance mode.

view this post on Zulip starseeker (Sep 14 2023 at 14:17):

For patch/pull request purposes (or maintaining our own fork in a worst case scenario) should I make a BRL-CAD/appleseed fork? Or would you prefer I keep it in my own project space for now?

view this post on Zulip Sean (Sep 14 2023 at 14:20):

Their activity, notwithstanding, wouldn’t want to give me impression that we’re trying to take over the project. I think whatever makes it easier for us to make and provide clean patches, that is what we should probably do. I don’t know if that means a fork or your own space for now, but probably the latter? I think the immediate goal would be to get direct permit to help inspire their project activity.

view this post on Zulip Sean (Sep 14 2023 at 14:21):

Commit

view this post on Zulip starseeker (Sep 14 2023 at 14:21):

<nod> I figured my own space was better, but I didn't want to leave anybody else out in the cold if they wanted to jump in

view this post on Zulip Sean (Sep 14 2023 at 14:25):

I think that’s fine I mean that’s part of the reason for doing it as pull requests so that any collaboration or discussion happens over in their space.. If they don’t see that activity or don’t get involved, then we will end up with a likely fork, and I don’t think that would be a good thing.

view this post on Zulip starseeker (Sep 14 2023 at 14:25):

Agreed.

view this post on Zulip Sean (Sep 14 2023 at 14:28):

Just in case, you’re not tracking, that’s a graph, Kronos announced a new API for configurable rendering systems, configurable raytracing. That may be a future direction if things get too complicated with appleseed, but for now it’s my favorite course because it’s working.

view this post on Zulip Sean (Sep 14 2023 at 14:30):

Sorry, text to speech is being just lovely. “That’s a graph “ should’ve said at Siggraph

view this post on Zulip starseeker (Sep 14 2023 at 14:30):

I figured ;-) Did they have any sort of reference implementation yet?

view this post on Zulip Sean (Sep 14 2023 at 14:35):

Yeah, one of them is basically based off of Intel ospray, quite a few changes since our integration, and in some other ways, but they’ve been involved. It’s a standard that other renderers are adopting so in theory we could do librt rendering in another renderer .

view this post on Zulip starseeker (Sep 14 2023 at 14:35):

Hmm. Sounds interesting. Is our existing OSPray work potentially reusable in that context?

view this post on Zulip Sean (Sep 14 2023 at 14:36):

It’s one of the key takeaways that I still need to summarize…

view this post on Zulip starseeker (Sep 14 2023 at 14:36):

Ah, gotcha.

view this post on Zulip Sean (Sep 14 2023 at 14:39):

I mean it’s roughly useful sure. But some significant changes for sure. We have direct hooks in ospray, embree, and Ispc to make that work.

view this post on Zulip starseeker (Sep 14 2023 at 14:39):

Ah. I'd forgotten we hooked into lspc directly.

view this post on Zulip Sean (Sep 14 2023 at 14:42):

More render mods that are needed as ispc source code, but yeah. Tight optimizations.

view this post on Zulip starseeker (Sep 14 2023 at 15:13):

As long as I'm at it, I should probably see if I can get OSPray building in this setup as well.

view this post on Zulip Sean (Sep 14 2023 at 15:50):

Ospray is even more does than Appleseed but pretty smooth.

view this post on Zulip starseeker (Sep 14 2023 at 16:01):

even more dependencies you mean?

view this post on Zulip Sean (Sep 14 2023 at 16:09):

Yes

view this post on Zulip starseeker (Sep 14 2023 at 16:10):

That's intimidating - hopefully there's a fair bit of overlap.

view this post on Zulip starseeker (Sep 14 2023 at 23:25):

OK, so good news and bad news. Good news is I finally got ISPC to compile on Linux. The bad news is they apparently have a hard requirement for GNU m4 during build - I tried one of the BSD m4 implementations and it couldn't handle their m4. I also confirmed with the ISPC project they have no interest in m4 portability - they use Cygwin's bundled m4.

view this post on Zulip starseeker (Sep 14 2023 at 23:26):

Porting GNU m4 to Windows... I supposed I can do it in the end if absolutely necessary, but that's looking to be a non-trivial exercise - and it's GPL to boot.

view this post on Zulip starseeker (Sep 15 2023 at 22:24):

Yikes. They also require Python. And of course that doesn't install cleanly even on Linux... grr.

view this post on Zulip starseeker (Sep 15 2023 at 22:35):

It cuts against the grain, but maybe the practical thing to do is require an install of Python3 to build the OSPray stack

view this post on Zulip starseeker (Sep 15 2023 at 22:36):

I think I immediately hit this issue: https://github.com/python/cpython/issues/90737

view this post on Zulip starseeker (Sep 15 2023 at 23:43):

Oh well - a bunch of asterisks, but stil: image.png

view this post on Zulip starseeker (Sep 18 2023 at 15:34):

Ah hah.
image.png

view this post on Zulip starseeker (Sep 20 2023 at 06:38):

Perhaps I'm missing something obvious: when trying to use a bundled icu and xerces-c, I'm getting the following error:

./bin/art
./bin/art: symbol lookup error: /home/user/brlcad/build/lib/libxerces-c-3.2.so: undefined symbol: UCNV_FROM_U_CALLBACK_SUBSTITUTE_73

If I check ldd I see what I expect:

$ ldd lib/libxerces-c-3.2.so
    linux-vdso.so.1 (0x00007fff109f1000)
    libicuuc.so.73 => /home/user/brlcad/build/lib/libicuuc.so.73 (0x00007f212c406000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f212c000000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f212ce14000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f212cdf0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f212bc00000)
    libicudata.so.73 => /home/user/brlcad/build/lib/libicudata.so.73 (0x00007f212cde5000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f212cf20000)

And if I check nm -D on the files in question, I'm getting:

$ nm -D /home/user/brlcad/build/lib/libicuuc.so |grep UCNV_FROM_U_CALLBACK_SUBSTITUTE_73
00000000000de680 T UCNV_FROM_U_CALLBACK_SUBSTITUTE_73
$ nm -D /home/user/brlcad/build/lib/libxerces-c-3.2.so |grep UCNV_FROM_U_CALLBACK_SUBSTITUTE_73
                 U UCNV_FROM_U_CALLBACK_SUBSTITUTE_73

How do I interpret this? Why does libxerces-c-3.2.so not get the definition from libicuuc.so?

view this post on Zulip starseeker (Sep 21 2023 at 01:35):

Nevermind, I figured it out - LIEF isn't handling the libicuuc.so file correctly: https://github.com/lief-project/LIEF/issues/969

view this post on Zulip starseeker (Sep 21 2023 at 01:36):

Back to patchelf for now...

view this post on Zulip starseeker (Sep 22 2023 at 00:38):

Sweet - upstream was able to fix. plief re-enabled

view this post on Zulip Sean (Jan 23 2024 at 15:29):

@Christopher possibly of assistance on the windows crash... https://drmemory.org

view this post on Zulip starseeker (Apr 15 2024 at 17:46):

Hey Sean, out of curiosity do you know how the OpenMoonRay renderer from DreamWorks compares to Appleseed?

view this post on Zulip Sean (Apr 17 2024 at 17:03):

@starseeker heh, that's like asking how NX compares with Solidworks... They're both production renderers. OpenMoonRay is certainly newer and with lots of really cool features. However, the critical feature Appleseed provided was the hook that allows for the ray intersection query to be replaced with librt. There has been a lot of standardization from Khronos to try and make that a thing all renderers provide, but I've not yet explored how much work that would entail.

view this post on Zulip starseeker (Apr 17 2024 at 17:44):

@Sean Fair enough. I suppose since OpenMoonRay was asking for help with a Windows port it wouldn't buy us much practically speaking anyway at this point, even if we could plug librt into it as-is...

view this post on Zulip Sean (Apr 17 2024 at 17:53):

I mean I definitely had the same thought -- gave a nice talk last year at Kronos BoF last year siggraph.

view this post on Zulip Sean (Apr 17 2024 at 17:54):

Wasn't the only code in discussion too. There's a couple others that might give us production plug-in rendering via librt if the standardization sticks and is adopted. But it was all being announced, so little to go on just yet.

view this post on Zulip starseeker (Apr 17 2024 at 17:58):

Gotcha. I know a fair chunk of the dependency stack will be the same regardless thanks to everybody using that VFX Platform set, so if it does make sense someday most of the painful part will probably already be handled. I know at this point hunting down our Appleseed Windows issues almost has to be less work than any other option, but I'm a little leery of how quiet the Appleseed upstream is...

view this post on Zulip Sean (May 21 2024 at 17:12):

Interesting and relevant, neutral PBR coloring for realistic CAD lighting:
Press Release - The Khronos Group Inc

view this post on Zulip Himanshu (Jun 05 2024 at 20:55):

@Sean which version of appleseed can help for art? Currently I pulled the latest one 2.1.0-beta and tried to compile art and VS complaining for #include "foundation/containers/dictionary.h" not found. I saw that this containers/dictionary.h is not present inside appleseed.

view this post on Zulip Himanshu (Jun 05 2024 at 21:02):

log/consolelogtarget.h" and utility/searchpaths.h is also not present appleseed/include/foundation.

view this post on Zulip Himanshu (Jun 05 2024 at 21:03):

I am getting these errors from art.cpp and brlcadplugin.cpp.

view this post on Zulip Himanshu (Jun 05 2024 at 21:04):

I saw this PR in our brlcad repo Fix appleseed error when appleseed version > 2.0 #116 by Rainy-fall-end · Pull Request #117 · BRL-CAD/brlcad (github.com)

view this post on Zulip starseeker (Jun 06 2024 at 01:39):

The Appleseed I've been using for testing is here: https://github.com/BRL-CAD/appleseed

view this post on Zulip Himanshu (Jun 07 2024 at 20:24):

starseeker said:

The Appleseed I've been using for testing is here: https://github.com/BRL-CAD/appleseed

Btw any binary version of appleseed you know that is stable for windows?

view this post on Zulip Himanshu (Jun 07 2024 at 20:24):

I am asking because now I saw that I have to build it :sweat_smile:

view this post on Zulip Himanshu (Jun 07 2024 at 21:07):

Btw I have Visual Studio 2022 so is it gonna work?

view this post on Zulip Himanshu (Jun 07 2024 at 21:08):

/me astonished by the download size of appleseed and its windows-deps.

view this post on Zulip Sean (Jun 07 2024 at 21:09):

I tested both the last stable build (from a couple years ago) and a recent dev build and got both to work.

view this post on Zulip Sean (Jun 07 2024 at 21:10):

Most recently used 2022 so that should be fine. Bigger issue was dependencies, making sure to match the compile settings.

view this post on Zulip Himanshu (Jun 07 2024 at 21:13):

Sean said:

I tested both the last stable build (from a couple years ago) and a recent dev build and got both to work.

@Sean you tried this one 2.1.0-beta ?

view this post on Zulip Himanshu (Jun 07 2024 at 21:22):

Is this step Edit Boost_* component variables to have 'lib' prefix (e.g., libboost_atomic... instead of boost_atomic...) is still required mentioned in readme?

view this post on Zulip Himanshu (Jun 07 2024 at 21:22):

Because I am not able to find how to edit it using CMake GUI.

view this post on Zulip Sean (Jun 07 2024 at 21:26):

Yeah I think I tried the beta too but there are even more recent builds on Discord

view this post on Zulip Sean (Jun 07 2024 at 21:27):

I do believe the boost mods are required for all the versions, it’s a cmake issue.

view this post on Zulip Sean (Jun 07 2024 at 21:27):

Turn on advanced variables and run configure once, the you’ll see them.

view this post on Zulip Himanshu (Jun 07 2024 at 21:29):

Sean said:

Yeah I think I tried the beta too but there are even more recent builds on Discord

I extracted the beta and I saw the errors that I am getting is for missing files.
image.png

view this post on Zulip Himanshu (Jun 07 2024 at 21:29):

Sean said:

Turn on advanced variables and run configure once, the you’ll see them.

Done that. And I find boost too there but those variables names of boost I'm not able to edit it. Only values I can edit I see.

view this post on Zulip Sean (Jun 07 2024 at 21:30):

Does the latest trunk have the files? I don’t recall

view this post on Zulip Himanshu (Jun 07 2024 at 21:31):

Yes latest main branch contain that file which is missing in beta build binaries. appleseed/src/appleseed/foundation/containers/dictionary.h at master · appleseedhq/appleseed (github.com)

view this post on Zulip Himanshu (Jun 07 2024 at 21:32):

Containers directory is missing from beta binaries.

view this post on Zulip Sean (Jun 07 2024 at 21:32):

Yeah so then don’t bother with the beta. I think I manually added the missing headers but that was a long time ago

view this post on Zulip Himanshu (Jun 07 2024 at 21:33):

Any stable binary version you know that I can use now to test art?

view this post on Zulip Himanshu (Jun 07 2024 at 22:10):

Wow I am shocked that I downloaded a latest one from their discord channel and those files which are missing now present inside.

view this post on Zulip Himanshu (Jun 07 2024 at 22:10):

/me happy for now until I start building art tomorrow.

view this post on Zulip Sean (Jun 07 2024 at 22:21):

Yeah give that a try first. The trick is finding the same boost that they compiled with

view this post on Zulip Sean (Jun 07 2024 at 22:22):

Has to be the same version as boost has various incompatibilities

view this post on Zulip Sean (Jun 07 2024 at 22:22):

The beta was five years ago

view this post on Zulip Himanshu (Jun 08 2024 at 19:44):

@Sean here what I got but I didn't see the output:
image.png
art.png

view this post on Zulip Christopher (Jun 08 2024 at 19:50):

Himanshu said:

Sean here what I got but I didn't see the output:
image.png
art.png

It can’t find the bundled appleseed oso shader (as_plastic). art.exe needs to be able to find it in one of the paths in the line that reads “Setting osl shader search paths to..”

view this post on Zulip Himanshu (Jun 08 2024 at 19:52):

Christopher said:

Himanshu said:

Sean here what I got but I didn't see the output:
image.png
art.png

It can’t find the bundled appleseed oso shader (as_plastic). art.exe needs to be able to find it in one of the paths in the line that reads “Setting osl shader search paths to..”

Oops I forgot to build brlcad.

view this post on Zulip Himanshu (Jun 08 2024 at 19:53):

After compiling art, I ran that command.

view this post on Zulip Himanshu (Jun 08 2024 at 20:24):

Hmm still OSL is complaining.

view this post on Zulip Himanshu (Jun 08 2024 at 20:26):

Are these .oso files present inside appleseed?

view this post on Zulip Christopher (Jun 08 2024 at 20:27):

I haven’t poked in the appleseed binary in a while, but they should be. In example shaders or something of the sort

view this post on Zulip Himanshu (Jun 08 2024 at 20:29):

Christopher said:

I haven’t poked in the appleseed binary in a while, but they should be. In example shaders or something of the sort

Ahh I see as_plastic.oso file is not present in appleseed

view this post on Zulip Himanshu (Jun 08 2024 at 20:30):

Oh.. okay it' s present. My bad.

view this post on Zulip Himanshu (Jun 08 2024 at 20:31):

Why it is not finding then :face_with_peeking_eye:

view this post on Zulip Christopher (Jun 08 2024 at 20:31):

Quick / dirty check would be to copy it over into your brl-cad debug bin/output/shaders and see if it can find it

view this post on Zulip Himanshu (Jun 08 2024 at 20:35):

Christopher said:

Quick / dirty check would be to copy it over into your brl-cad debug bin/output/shaders and see if it can find it

Yeah, now it is able to find that as_plastic.so but new shader is missing as_closure2surface.oso

view this post on Zulip Himanshu (Jun 08 2024 at 20:38):

Finally:
art.png

view this post on Zulip Christopher (Jun 08 2024 at 20:38):

Darn. So it is missing the path somewhere then :sweat_smile:

view this post on Zulip Himanshu (Jun 08 2024 at 20:39):

Samples here are so low? Why it is looking so blurry.

view this post on Zulip Christopher (Jun 08 2024 at 20:39):

There’s a sampling knob you can turn somewhere. Let me see if I can hunt up the magic to do it

view this post on Zulip Himanshu (Jun 08 2024 at 20:41):

Btw when I given path for appleseed_ROOT, other two variables include and lib didn't recognize the path after I hit configure. So manually I have given the path to both two.
image.png

view this post on Zulip Christopher (Jun 08 2024 at 20:44):

Himanshu said:

Samples here are so low? Why it is looking so blurry.

try adding

-c “set samples=50”
to your command line

view this post on Zulip Christopher (Jun 08 2024 at 20:45):

looks like default samples is 25. Keep in mind, the more samples the longer the render time

view this post on Zulip Himanshu (Jun 08 2024 at 20:46):

Christopher said:

Himanshu said:

Samples here are so low? Why it is looking so blurry.

try adding

-c “set samples=50”
to your command line

Hmm, now I just saw it.
image.png

view this post on Zulip Himanshu (Jun 08 2024 at 20:48):

Btw @Christopher what device it is using for rendering? CPU or GPU?

view this post on Zulip Himanshu (Jun 08 2024 at 20:48):

I ran the command and I didn't see any spike in performance in task manager for both cpu and gpu. I ran that command using 100 samples.

view this post on Zulip Christopher (Jun 08 2024 at 20:51):

Himanshu said:

I ran the command and I didn't see any spike in performance in task manager for both cpu and gpu. I ran that command using 100 samples.

Did you see the upped samples improve the image? It’s possible that command isn’t the correct foo.
If it did, moss world is pretty trivial, it may need a lot of work to notice a spike in the task manager

view this post on Zulip Christopher (Jun 08 2024 at 20:52):

Himanshu said:

Btw Christopher what device it is using for rendering? CPU or GPU?

It hooks directly into BRL-CADs rt - which I believe is cpu bound

view this post on Zulip Himanshu (Jun 08 2024 at 20:52):

Christopher said:

Himanshu said:

I ran the command and I didn't see any spike in performance in task manager for both cpu and gpu. I ran that command using 100 samples.

Did you see the upped samples improve the image? It’s possible that command isn’t the correct foo.
If it did, moss world is pretty trivial, it may need a lot of work to notice a spike in the task manager

I upped it to 500 samples. Now I saw some visible difference :sweat_smile:

view this post on Zulip Himanshu (Jun 08 2024 at 20:53):

Okay I saw a spike where my cpu was 2% and raised to 10-17%.

view this post on Zulip Christopher (Jun 08 2024 at 20:54):

Ah ok. That seems correct

view this post on Zulip Himanshu (Jun 08 2024 at 20:54):

Christopher said:

Himanshu said:

Btw Christopher what device it is using for rendering? CPU or GPU?

It hooks directly into BRL-CADs rt - which I believe is cpu bound

So we can't switch it to GPU for now I guess.

view this post on Zulip Himanshu (Jun 08 2024 at 20:56):

Hmm I see art complains for OSL headers not found.

view this post on Zulip Himanshu (Jun 08 2024 at 20:56):

So how to fix that? Again build it?

view this post on Zulip Himanshu (Jun 08 2024 at 20:57):

idk but I followed this Appleseed - BRL-CAD (brlcad.org)

view this post on Zulip Sean (Jun 12 2024 at 19:33):

I don't think you need the headers at that point. It possibly affects the compilation of new shaders as that is done on the fly.

view this post on Zulip Sean (Jun 12 2024 at 19:33):

Most concerning quality-wise is the lighting setup it still not decent. It's too dark by default. I think it's just using default hard-coded value right now.

view this post on Zulip Himanshu (Jun 14 2024 at 12:24):

Sean said:

I don't think you need the headers at that point. It possibly affects the compilation of new shaders as that is done on the fly.

Did I miss something during cmake part? Because after I compiled art and ran it, it's complaining for OSL headers.

view this post on Zulip Himanshu (Jun 14 2024 at 13:00):

@Sean Where I should start looking for the files? Because the goal here will be to make art read and work with any OSL or MaterialX shader networks, including ones using texturing, emission, subsurface scattering, etc. applied to BRL-CAD geometry.

view this post on Zulip Christopher (Jun 14 2024 at 13:33):

Himanshu said:

Sean Where I should start looking for the files? Because the goal here will be to make art read and work with any OSL or MaterialX shader networks, including ones using texturing, emission, subsurface scattering, etc. applied to BRL-CAD geometry.

art is relying on precompiled osl shaders (.oso). The first step would be to get appleseed to recognize the need, and compile .osl on demand. There is already skeleton code tying in MaterialX, so the jump after supporting osl compilation should be pretty straight forward

view this post on Zulip Sean (Jun 14 2024 at 15:11):

I remember seeing code for compiling .osl files on the fly, but definitely not seeing it in there now...

view this post on Zulip Sean (Jun 14 2024 at 15:12):

there's just one mention in region registration that the form for uncompiled osl's is different.

view this post on Zulip Sean (Jun 14 2024 at 15:13):

It may be something that Appleseed does automatically -- I'd check the code to asr:: Shader_Group to see what they do -- could very well be automatic if the headers and such are found properly.

view this post on Zulip Himanshu (Jun 14 2024 at 20:18):

So I need to see first why OSL headers are not being found by art. Then only I can proceed with Physically-Based Rendering (PBR) advanced shaders · Issue #71 · opencax/GSoC (github.com)

view this post on Zulip Himanshu (Jun 14 2024 at 20:21):

Idk if I did something wrong during doing cmake and build but one way is still there that I didn't test it yet which is building appleseed in windows which is maintained here BRL-CAD/appleseed: DEPENDENCY: A modern open source rendering engine for animation and visual effects (github.com).

view this post on Zulip Himanshu (Jun 14 2024 at 20:21):

Because idk which binary version actually going to make it work.

view this post on Zulip Himanshu (Jun 14 2024 at 20:47):

Initially I have set Appleseed_ROOT but still after one time configure it shows it can't find include and libs of appleseed:
image.png
image.png

view this post on Zulip Himanshu (Jun 15 2024 at 07:21):

Oh I see now. I just copied shaders dir from appleseed to brlcad_appleseed so that art can find all those .oso file that is required for rendering.

view this post on Zulip Himanshu (Jun 15 2024 at 07:23):

Is there any way I can see objects of a .g file using art so that I can pass that object instead of all.g?

view this post on Zulip Himanshu (Jun 15 2024 at 07:27):

Using rt:
image.png

view this post on Zulip Himanshu (Jun 15 2024 at 07:27):

@Sean rt vs art ?

view this post on Zulip Sean (Jun 18 2024 at 20:52):

@Himanshu you can use mged for that: mged file.g tops

view this post on Zulip Sean (Jun 18 2024 at 20:53):

It just happens to be named all.g for moss.g but could be named anything. You can run ls instead of tops to see all objects or search / to print a hierarchical listing, etc.

view this post on Zulip Sean (Jun 18 2024 at 20:54):

If you have at rt command working you should be able to replace it with art to get the same rendering using Appleseed optics instead of rt’s, if that wasn’t obvious also.

view this post on Zulip starseeker (Jun 26 2024 at 23:34):

Sigh. Well, the good news is I got virtually all the dependencies updated, make check passes, and I got art to compile on Ubuntu with the latest LLVM 18 and OSL 1.3.10.0. The bad news is all I get is a black silhouette of moss in the output image, and I don't have a clue what's wrong.

view this post on Zulip starseeker (Jun 26 2024 at 23:39):

99% of the OSL tests pass, at least from the build directory.

view this post on Zulip Sean (Jun 27 2024 at 05:45):

Might help to check the OSL release notes. I'd guess some default light value / variable was introduced that is initialized to zero. The fact that you get a silhouette implies the ray tracing itself is just fine, but does point at OSL update introducing some change.

view this post on Zulip Himanshu (Jun 29 2024 at 14:55):

art.png
500 samples.

view this post on Zulip Sean (Jun 29 2024 at 15:45):

That looks pretty good. Can you see if you can figure out why it’s so dark and washed out? It might be a setting automatically being written to the project in art.cpp probably wherever it’s setting that blue background.

view this post on Zulip Sean (Jun 29 2024 at 15:47):

With rt, we have a notion of default environment ambient lighting. For art, we probably need to make a global light source that is tied to the default ambient value so it’s both brighter by default but also can be made brighter or darker based on the -A value.

view this post on Zulip Sean (Jun 29 2024 at 15:51):

Lights are one thing that hasn’t been implemented yet because someone will need to figure out a way to map lights or specify lighting via shaders the way Appleseed does it. Our existing light settings are liboptical so they don’t have to be preserved or used, but if would be convenient if they did map to something.

view this post on Zulip Sean (Jun 29 2024 at 15:51):

An example of that is in moss where there is a little light sphere right in the middle of the model.

view this post on Zulip Himanshu (Jun 29 2024 at 15:56):

Sean said:

An example of that is in moss where there is a little light sphere right in the middle of the model.

image.png
Are you talking about this one?

view this post on Zulip Himanshu (Jun 30 2024 at 10:14):

@Sean Here what I found light_intensity *= AmbientIntensity; in line 253 of art.cpp, I guess light_intensity determines how bright the light source is and AmbientIntensity is a general light that affects all objects in the scene equally.

view this post on Zulip Himanshu (Jun 30 2024 at 10:14):

size_t light_intensity = 200.0;

view this post on Zulip Himanshu (Jun 30 2024 at 10:50):

Hmm, I see AmbientIntensity = 0.4; in main.c for rt.

view this post on Zulip Himanshu (Jun 30 2024 at 11:13):

double AmbientIntensity = 0.4; this is used by art.

view this post on Zulip Himanshu (Jul 02 2024 at 23:47):

art1.png
Castle rendered per pixel 25 samples.

view this post on Zulip Sean (Jul 02 2024 at 23:47):

Himanshu said:

Are you talking about this one?

Yup!

view this post on Zulip Sean (Jul 02 2024 at 23:48):

Note that AmbientIntensity in rt (and presumably art, but maybe not) is controlled via the existing -A option, so you can specify -A1 for example

view this post on Zulip Himanshu (Jul 02 2024 at 23:56):

Sean said:

Note that AmbientIntensity in rt (and presumably art, but maybe not) is controlled via the existing -A option, so you can specify -A1 for example

art.png

view this post on Zulip Himanshu (Jul 02 2024 at 23:56):

hmm now it's bright I can see.

view this post on Zulip Himanshu (Jul 02 2024 at 23:57):

So 0.4 is playing the part here I see.

view this post on Zulip Himanshu (Jul 03 2024 at 00:03):

art.png
How I can change the color of bishop?

view this post on Zulip Christopher (Jul 03 2024 at 04:44):

Himanshu said:

art.png
How I can change the color of bishop?

the color is coming from the bishop model. You could use the 'mater' command (something like "mater bishop.r . 0 255 0 .") would set the bishop green, for example

view this post on Zulip Himanshu (Jul 03 2024 at 23:20):

art.png
500 samples. Looks good now.

view this post on Zulip Himanshu (Jul 03 2024 at 23:25):

@Christopher I am confused little bit for what is shader? I know shader is like a program that runs in gpu. So here shaders have different meaning?

view this post on Zulip Himanshu (Jul 03 2024 at 23:27):

oops these are material shaders I guess.

view this post on Zulip Himanshu (Jul 04 2024 at 00:02):

I am wondering now if entire graphics pipeline is written in C++ like Vulkan then what does shaders play a role in graphics pipeline?

view this post on Zulip Sean (Jul 04 2024 at 00:57):

A shader is a bit of logic that gives geometry appearance. Does not have to involve a gpu as it is a general concept with many kinds of implementations. Imagine you have an empty window or image and I tell you which pixels have geometry. Shaders are the bit of logic that colors the pixels.

view this post on Zulip Sean (Jul 04 2024 at 01:02):

A classic shader taught in intro graphics classes is the phong shader. You can read the wiki page but the basic idea is to consider the color and angle of the surface for a given hit point and that gives a nice simplified appearance of the surface curvature. With a couple other inputs, you can make things appear shiny, flat, transparent, etc with very little code and very few parameters.

view this post on Zulip Sean (Jul 04 2024 at 01:08):

For production rendering, you typically do not use gpu shaders like glsl for various reasons. In BRL-CAD there is liboptical shaders (see src/liboptical) which is what rt uses and there are shaders supported by appleseed which includes their own old-style shaders like rt’s as well as a newer general production rendering shader framework called Open Shading Language or OSL shaders for more advanced rendering. Art creates an OSL shader definition automatically when loading and preparing geometry for rendering.

view this post on Zulip Himanshu (Jul 08 2024 at 20:59):

@Sean So deafult value of AmbientIntensity is set to 0.4. light_intensity *= ambient_intensity scales light intensity based on the ambient intensity. This is why scene looks darker when the ambient intensity is 0.4 and brighter when it is 1.0.

view this post on Zulip Himanshu (Jul 08 2024 at 21:01):

I guess now it's time to start Physically-Based Rendering (PBR) advanced shaders · Issue #71 · opencax/GSoC (github.com).

view this post on Zulip Himanshu (Jul 08 2024 at 21:06):

my question is why the default value is 0.4 when we know we will be getting darker image . Why not always 1.0? Or it will depend on light intensity always?

view this post on Zulip Christopher (Jul 08 2024 at 22:11):

Himanshu said:

my question is why the default value is 0.4 when we know we will be getting darker image . Why not always 1.0? Or it will depend on light intensity always?

I don't think there is any specific reason 0.4 was settled on. In well defined scenes, with multiple light sources, too high of a value will white-wash the image. And, as you've seen with a single light source in the example models, too low a value will make it darker. Somewhere in the middle gives flexibility from render to render.

view this post on Zulip Himanshu (Jul 08 2024 at 22:17):

So to start with I should do this "The first step would be to get appleseed to recognize the need, and compile .osl on demand." So where I should look at? I mean code files.

view this post on Zulip Sean (Jul 08 2024 at 22:30):

Himanshu said:

my question is why the default value is 0.4 when we know we will be getting darker image . Why not always 1.0? Or it will depend on light intensity always?

With rt, we don't necessarily get a darker image as the default lighting has been calibrated for ambient+direct so that you typically see something when you render, and it's typically not too bright and not too dark.

As for why that value -- I can only speculate as it's always been 0.4 for rt. That value goes all the way back to 1989 and wasn't documented. Now that said, the intention of the value is the contribution of ambient light to the rendering equation, and the 0.4 means 40% of the illumination is from ambient and 60% is coming from direct lighting.

There are default direct lights in rt that are automatically created -- I don't believe we create the same default direct lights in art, so we're only/mostly seeing the contribution from the ambient parameter.

view this post on Zulip Sean (Jul 08 2024 at 22:34):

BUT they're also entirely different light spaces with different rendering approaches so getting rt and art to roughly match using the same value was probably wishful thinking. What's really needed is to calibrate the intensity of a test image with controlled light conditions against an identical render environment.

That would be like creating a simple sphere on a black background, rendering with rt, calculating the average intensity at 0.4 and a couple other values like A=0.0 through A=2.0 in 0.1 increments. The default lights rt creates would need to be created in art as well, or eliminate the default light in rt and compare with a similar light definition with art, make art's background also black, then calibrate the AmbientIntensity value across that same sepectrum to produce the same intensity from art.

view this post on Zulip Christopher (Jul 08 2024 at 22:55):

Himanshu said:

So to start with I should do this "The first step would be to get appleseed to recognize the need, and compile .osl on demand." So where I should look at? I mean code files.

That will hinge largely on building and bundling appleseed with BRL-CAD. The pipeline is in place with 'bext', but building appleseed, OSL, and the rest of the dependency stack is still very fragile. That is actively being worked on by starseeker and myself.

It may be an easier starting point, since you're also getting familiar with the lighting system, to look at translating BRL-CAD designated light sources into appleseed light sources.

view this post on Zulip Christopher (Jul 08 2024 at 22:57):

Right now, only one point light is being generated with each scene (src/art/art.cpp ~733). Ideally, this would not only be a hard coded light source but would use BRL-CAD material shaders designated as lights and create them

view this post on Zulip Sean (Jul 08 2024 at 23:14):

Yeah, Rt creates three lights by default that are auto positioned for a given scene being rendered. Art needs to do that and ideally support custom lights too.

view this post on Zulip Himanshu (Jul 08 2024 at 23:22):

Sean said:

Yeah, Rt creates three lights by default that are auto positioned for a given scene being rendered. Art needs to do that and ideally support custom lights too.

Is there any specific thing like deciding how many lights will be there in a scene? Like art now have only one light. So the number of lights in a scene can be decided through a user I guess? So what I came to know up to now is that BRL-CAD material shaders can be designated to define lights. This means that instead of hard-coding light sources, we can use material shaders within BRL-CAD to specify lighting properties.

view this post on Zulip Himanshu (Jul 08 2024 at 23:25):

So ambient intensity, light intensity, light color and light position value will be extracted from the shaders I guess?

view this post on Zulip Sean (Jul 10 2024 at 05:51):

What I was going to say is that in Rt, there are different lighting modes (see src/rt/view.c header comments) where it creates either one or three default lights (see light_maker() in src/liboptical/sh_light.c) depending on the lighting mode UNLESS there are explicit lights in the scene (e.g., moss.g's all.g scene has a light).

The default for as long as I can remember is supposed to be 3 lights, but I just now noticed that it appears another dev changed the default back to just one light back in 2004. So looks like current is just one light at the eye.

view this post on Zulip Sean (Jul 10 2024 at 05:53):

Got to say, the 3-light model looks much better on havoc:
Screenshot-2024-07-10-at-1.40.22-AM.png

Looks like it was disabled due to too much blooming on some models.

view this post on Zulip Sean (Jul 11 2024 at 20:23):

Now I kind of want to revisit whether we can restore 3-light as a brighter default. Will have to run a slew of tests to see if I can get at the blooming issues Lee encountered, how prevalent and if they can be overcome.

view this post on Zulip Sean (Jul 13 2024 at 16:35):

Himanshu said:

So ambient intensity, light intensity, light color and light position value will be extracted from the shaders I guess?

It's both -- even with PBR, you have some notion of global light and users need to be able to configure what that light is like. In rt, we just have the -A ambient knob, -l lighting model type, and a default automatic light. If the user creates lights manually, the default light is disabled and it just uses what they specified (so they get that light plus the -A ambient light). In those manually specified lights, they can control light intensity, color, and position as classical/old/liboptical shader settings.

With art, it's kind of the same situation with there needing to be default automatic light(s), possibly some ambient light separately, and definitely explicit lights defined via new/pbr/osl shaders.

Make sense?

view this post on Zulip Himanshu (Jul 17 2024 at 15:25):

Sean said:

Got to say, the 3-light model looks much better on havoc:
Screenshot-2024-07-10-at-1.40.22-AM.png

Looks like it was disabled due to too much blooming on some models.

left one havoc have three lights compared to right one where it only contain one light?

view this post on Zulip Himanshu (Jul 17 2024 at 15:35):

Sean said:

Now I kind of want to revisit whether we can restore 3-light as a brighter default. Will have to run a slew of tests to see if I can get at the blooming issues Lee encountered, how prevalent and if they can be overcome.

So we can apply three lights to bishop too.

view this post on Zulip Himanshu (Jul 17 2024 at 15:40):

Sean said:

Himanshu said:

So ambient intensity, light intensity, light color and light position value will be extracted from the shaders I guess?

It's both -- even with PBR, you have some notion of global light and users need to be able to configure what that light is like. In rt, we just have the -A ambient knob, -l lighting model type, and a default automatic light. If the user creates lights manually, the default light is disabled and it just uses what they specified (so they get that light plus the -A ambient light). In those manually specified lights, they can control light intensity, color, and position as classical/old/liboptical shader settings.

With art, it's kind of the same situation with there needing to be default automatic light(s), possibly some ambient light separately, and definitely explicit lights defined via new/pbr/osl shaders.

Make sense?

Hmm now I understand.

view this post on Zulip Himanshu (Jul 17 2024 at 15:42):

BRL-CAD has preliminary support for material objects including OSL shaders and MaterialX shaders in art, however their support has only been tested with basic shaders such as the Disney Principled Shader. It's hard-wired to single-file shaders.

Where I can find disney principled shader so that I can test it too? Also what do you mean by hard-wired to single-file shaders?

view this post on Zulip Christopher (Jul 17 2024 at 16:03):

Himanshu said:

Where I can find disney principled shader so that I can test it too?

appleseed bundles with as_disney_material (I think is the name)

Also what do you mean by hard-wired to single-file shaders?

art is using a default plastic osl shader with color mapping. logic around 395-510 in src/art/art.cpp

view this post on Zulip Himanshu (Jul 17 2024 at 16:09):

So we need to expand it. Like art will be able to read any osl shader.

view this post on Zulip Himanshu (Jul 17 2024 at 16:10):

Ahh, now I realize that is the goal mentioned Physically-Based Rendering (PBR) advanced shaders · Issue #71 · opencax/GSoC (github.com) here.

view this post on Zulip Christopher (Jul 17 2024 at 16:12):

Himanshu said:

So we need to expand it. Like art will be able to read any osl shader.

Yes, that is the eventual goal. There is a rough mechanism through the 'material' command that will use the shader if it can find it (art.cpp: lines 400-415), but that will need to get much more user friendly.


Last updated: Oct 09 2024 at 00:44 UTC